It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Non logical code in Ganesh and Sharma book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Non logical code in Ganesh and Sharma book" Watch "Non logical code in Ganesh and Sharma book" New topic
Author

Non logical code in Ganesh and Sharma book

T . M Badr
Greenhorn

Joined: Mar 05, 2014
Posts: 14
This is quoted from Ganesh and Sharma book page 89:


Now let's discuss another scenario where a common functionality needs to be supported by all the shape objects.
For instance, each object could be drawn inside another shape object, which means each shape object has a parent
(i.e., containing) object. As pointed out earlier, abstract classes are the best place to put a common functionality.



But how child classes can use the getter and setter of the parentShape, parentShape is defined as private in the base class, which makes it not accessible by other classes.
T . M Badr
Greenhorn

Joined: Mar 05, 2014
Posts: 14
Sorry, my mistake, the code is fine.

How can I delete this post?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Non logical code in Ganesh and Sharma book