This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Question about inheritance


Alexandre Oliva wrote:
> 
Peter V Evans <pevans@enteract.com> writes:
> a better question would be, how to get doit to somehow see the
> derived class "hi" instead of the parent class "hi"?

I missed this the first time.  You would *never* want a superclass to
know about subclasses.  Dependencies should *always* go from the
subclass to the superclass.  If any of your dependencies go the other
way, then all your subclasses wind up depending on that one subclass. 
This breaks one of the biggest tenets of OO -- localisation of effects
due to changes in code.  IOW, it causes major headaches for testing and
enhancements.

Noel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]