access-modifiers
When overriding a method, why can I increase access but not decrease it?
Why does Java specify that the access specifier for an overriding method can allow more, but not less, access than the overridden method?开发者_Go百科 For example, a protected instance method in the s[详细]
2023-03-23 04:24 分类:问答Why can't a class or an interface receive private or protected access modifiers?
I am reading some Java text and the text says that we can only apply public or default access modifier for class and interface. Therefore, it is a compiling error i开发者_运维知识库f we declare:[详细]
2023-03-20 21:56 分类:问答Naming public static final in lowercase?
I have a hierarchy of classes: class Page { } class ChildPage1 extends Page { private static final String URL;[详细]
2023-03-20 11:32 分类:问答Package modifier produces error
Eclipse is giving me an error when defining a top level class with the package modifier, the error is :[详细]
2023-03-20 03:34 分类:问答C#: Why do I have to use the public access modifier in class's vars?
OK, well, I am a beginner, so.. yeah, this may be a very stupid question. I read that if I declare variable or object, without mentioniong the access-modifier (public, private, etc.) than it\'s automa[详细]
2023-03-16 17:22 分类:问答Is the copy CTOR required even if never called?
consider the following: class X { public: X(int i) { cout << \"X(int i)\" << endl; } X(const X& x) { cout << \"X(const X& x)\" << endl; }[详细]
2023-03-12 06:11 分类:问答Why can't we change access modifier while overriding methods in C#?
In C#, we can not change access modifier while overriding a method from base class. e.g. Class Base { **protected** string foo()[详细]
2023-03-10 15:23 分类:问答Is there anything like an Internal class in Java?
In C# you can mark a class as internal so that it is开发者_开发技巧 only accessible from within the same package. Is there anything similar in Java?You can create package-private classes by omitting t[详细]
2023-03-05 16:46 分类:问答Different access modifiers of properties in C#
Can we have different access modifier for get and set in a property开发者_运维技巧?Yes, you can, however it is subject to the rule that your getter/setter cannot have a less restricted access modifier[详细]
2023-03-04 16:48 分类:问答Different Scoped Properties - Public getter and internal setter
I know you can do this public String<T> Get { get; private set; } The problem is I want the set method to开发者_C百科 be accessible from a different class within the same DLL (ie: internal)[详细]
2023-03-04 15:33 分类:问答