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
Joined: Mar 05, 2014
Sorry, my mistake, the code is fine.
How can I delete this post?
subject: Non logical code in Ganesh and Sharma book