View Single Post
  #1 (permalink)  
Old 01-05-2008, 03:33 PM
java_fun2007 java_fun2007 is offline
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
hiding inherited methods
hi,
I need to know how to hide a method from a subclass because it doesn't need it at all. I think using aggregation will solve the problem but how? do you have any examples regarding this please?

For example, if the class Dog defines the properties "bark," "fetch," and "eat food" then a class Cat can be derived from Dog by hiding "bark" and "fetch" and adding "purr" and "sleep." And then "bark" shouldn't appear in the Cat class, is using aggregation solve the problem? by putting the class Cat as "whole" and class Dog as its "part".
Reply With Quote
Sponsored Links