Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!pacbell.com!decwrl!pa.dec.com!hollie.rdg.dec.com!decuk.uvo.dec.com!shlump.nac.dec.com!bolt.enet.dec.com!minow From: minow@bolt.enet.dec.com (Martin Minow) Newsgroups: comp.sys.mac.programmer Subject: Re: How does Symantec implement inheritance? Message-ID: <20433@shlump.nac.dec.com> Date: 21 Feb 91 22:02:23 GMT Sender: newsdaemon@shlump.nac.dec.com Distribution: usa Organization: Digital Equipment Corporation Lines: 51 In article <1991Feb20.205941.5105@iitmax.iit.edu>, soudan@iitmax.iit.edu (Bassel Soudan) asks about multiple inheritance under the Think Class Library. Since the compiler doesn't support multiple inheritance, you either need to write your own or take some other application-specific action. For example, CStaticText is a descendent of CPanorama, but adds some methods that are data-specific (SetTextHandle, for example) and others that are command-specific. Another useful method is to split the task into two (or more) separate classes that are linked together by reference instance variables, following the philosophy behind CScrollPane and CPanorama. For example, I wrote a ListManager analog that consisted of two classes, struct ListSelector : CList { CSelector *itsSelector; void IListSelector(void); void InstallSelector( CSelector *aSelector ); PRIVATE void AdjustSelector(void); void ChangeSelection( short aSelection ); void Add( CObject *anObject ); /* etc. */ } and struct ListPanorama : CSelector { long itsDoubleClickCmd; void IListPanorama( ... boring CSelector/CPanorama parameters ... ); void Draw(...); void HiliteItem(...); The CSelector contained the visual and command hierarchies, while the ListSelector contained the data. When objects are added or removed from the list, the method calls AdjustSelector which adjust the CPanorama's bounds. A slightly buggy source file was posted to the Think-C mailing list a few weeks ago. (send mail to think-c-request@ics.uci.edu to join). Good luck - hope this isn't too confusing. Martin.