Excerpts from Yuri Shtil's message of Thu Sep 03 19:08:17 -0400 2009:
> What is wrong in excluding some of the derived classes from a subtype 
> definition?

Like Chris said:

> > One of the main points to object orientation is Subtype Polymorphism
> > ... meaning derived classes can be substituted for main classes, why
> > would you want to throw that away?

So, it breaks a fundamental part of OO.  That's what's wrong with it.

> It has nothing to do with inheritance/Polymorphism. I just want to limit 
> what can be saved in the attribute.

"Officer, I'm not driving under the influence, I just had a few beers and now
I'm operating this vehicle."

Subclasses that have less functionality than their superclasses are almost
always a design smell.  Maybe part of your superclass should actually be a
role?  I'm sure that if you wanted to give more specifics, people would be
willing to help look for a solution to your problem that is less likely to bite
you later.

hdp.

Reply via email to