This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Non logical code in Ganesh and Sharma book
 
Similar Threads
Cast Object back to its original type
Type problem
what is the need to declare a class abstract if it doesn't contain abstract methods?
doubt in abstract class and methods
Questions about polymorphism and interfaces