For my latest books on Java, including Introducing JavaFX 8 Programming, see HerbSchildt.com
8.2.1.3 Inheritance with private
In the example:
the class variable totalMoves can be used only within the class Point; it is not inherited by the subclass Point3d. A compile-time error occurs because method move of class Point3d tries to increment totalMoves.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
It doesn't. section 8.2.1.3 is specifically talking about private class (i.e. static) variables, and that's something else altogether. Private instance variables are inherited. After all, an instance of the subclass contains all variables used in its ancestor classes. The fact that these variables may not be directly accessible doesn't make any difference, they are still part of the object and can be manipulated through the superclasses' API.Originally posted by Joel McNary:
In fact, I believe that the JLS states that private members are not inherited.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
For my latest books on Java, including Introducing JavaFX 8 Programming, see HerbSchildt.com
Originally posted by Karen Gomes:
Hi Herbert,
Its really nice to be able to even write to you. Yes Complete reference has been my first book in java too. Ever since its first version to the latest I have them all.... kind of a BIBLE for Java. I know this is not where we review books but the book has changed my life and especially helped me in the beginning of my programming career ... so much that your name now confirms the book will be easy to understand and cover most of the concepts too ... be it Java/C++
Can you please let me know if you have any seminars or events that you may be attending (North East Coast of US). I would love to meet you in person
Your biggest Fan ever
Karen
For my latest books on Java, including Introducing JavaFX 8 Programming, see HerbSchildt.com
Pradeep: Actually Herb is just the short form of Herbert, so both are me. I don't know why Amazon shows it both ways. Perhaps it is to allow a search engine to find both forms.