hiding inherited methods
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".
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.