Summary:Within a class, its members (including member variables and member methods) can be interviewed by other classes, depending on the modifier of that member, and whether a class can be visited by other classes depends on the class's modifiers.
In Java, the three reserved words are used to modify the data members and member functions of the class, and the class itself. In C ++, the data members and member functions of the modifier class, and the inheritance of the class, but you don't need
Tips"Effective Java, third Edition" an English version has been published, the second edition of this book presumably many people have read, known as one of the four major Java books, but the second edition of 2009 published, to now nearly 8 years,
1. Protected access control characters can be used for methods and member variables.
2. Methods and member variables declared as protected can be accessed by all classes in the same package, just like the default modifier package.
3. Can be accessed
FIX: The original article was a bit of a mistake, mainly about the subclass of the member's inner class.Because of my cognitive limitations, it is assumed that the subclass of the inner class should also be an inner class, but in fact, the knowledge
In fact, this is simply a saying: "A subclass that is not in the same package as the base class can only access protected members inherited from the base class, you cannot access the protected members of the base-class instance ".
Java Study Notes 21 --- supplementary description of internal classes of members (2) (corrected), Study Notes 21 ---
Fixed: the original article was a bit incorrect, mainly concerning the subclass of the member's internal classes.
Due to my
First, ThreadJava/c++ is an object-oriented third-generation computer high-level programming language, its essence is identical, but the syntax is really different, a little attention is easy to cause confusion. This article summarizes some of the
1. The protected access controller can be used for methods and member variables.2. The methods and member variables declared as protected can be accessed by all classes in the same package, just like the default modifier package.3. The sub-class can
Java provides three access control permissions: Public protected private. Therefore, the access permission with the name "anonymous" means that external users cannot access the database. When inheriting the database, you must consider whether the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.