Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!purdue!haven!decuac!shlump.nac.dec.com!mcsse.enet.dec.com!heintze From: heintzefmcsse.enet.dec.com (Sieg Heintze) Newsgroups: comp.lang.c++ Subject: How to use Inheritance instead of nesting classes Summary: How to implement multiple linked lists using Inheritance? Keywords: Inheritance, class Message-ID: <13647@shlump.nac.dec.com> Date: 19 Jul 90 19:15:44 GMT Sender: newsdaemon@shlump.nac.dec.com Organization: Digital Equipment Corporation Lines: 24 I wanted to nest some classes inside of classes on Zortech C++ v2.01 and found out that this cannot be done like it can for pascal records. I ended up using pointers to the (sub)classes. Hmmph... Upon driving to work this morning it dawned on me that this is what inheritance is for! Well, well... I have finally found a use for inheritance - or have I? I have some entities, viewports to be specific, that must be able to reside multiple doubly linked lists at once. In otherwords, a view port might be both in the "mouse button depress queue" and in the "mouse motion queue" at the same time. For an entity to reside on a single list I could follow Bjarne's example in his book just fine. But how do I define an object that resides on multiple lists and use inheritance? Can I inherit the same object twice in the same class? Sieg heintze@genral.enet.dec.com Digital Equipment Corporation 1110 Chapel Hills Drive CXN2-2/35 Colorado Springs, CO 80920-3995 719-260-2184