View Single Post
  #2 (permalink)  
Old 01-05-2008, 04:16 PM
wsaryada wsaryada is offline
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
First I think Cat should never derived from Dog, as just in a real world Cat and Dog are different species. You could create an Animal class which then can be derived by both Cat and Dog.

If you correctly define your method you should not have to do method hiding this way. In Java the access modifier such as public, protected, the default and private can be choose whether the method or field can be inherited to the child class.
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote