S
Steve Walker
Mark Broadbent said:Yes, certainly there is an argument to be said for this however you are then
moving into the area of distinction between what is a subclass and what is a
subtype.
Now from an entire OOP design point of view I'd say that if you are needing
to hide public methods like this in your subclass then potentially you've
possibly implemented too much functionality in your base class. But there
are certain base classes that we want to use which are not under our control
and yet still provide all (and more that we don't) of the behaviour that
needs to be inherited as is the case here.
Best OOP example. What would you do with a Platypus class that inherits a
Mammal class?
Mammal m = new Mammal();
Mammal n = m.GivesBirth();
Platypus p = new Platypus();
Platypus q = p.GivesBirth(); //whoops! thats not valid for a Platypus
Platypus.Egg r = p.LaysEgg();
Platypus s = r.Hatch();
//cute aint he!
abstract class Mammal{}
abstract class Monotreme:Mammal
{
public abstract Egg LayEgg();
}
abstract class LiveBirthingMammal:Mammal
{
public abstract LiveBirthingMammal GiveBirth();
}
abstract class Marsupial:LiveBirthingMammal{}
abstract class Eutherian:LiveBirthingMammal{}
class Platypus:Monotreme{}
