Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!gatech!bloom-beacon!deccrl!news.crl.dec.com!halbert From: halbert@crl.dec.com (Dan Halbert) Newsgroups: comp.object Subject: Re: Examples of Multiple Inheritance? Message-ID: <1990Dec6.185634.24199@crl.dec.com> Date: 6 Dec 90 18:56:34 GMT References: <60700005@inmet> <1990Dec6.020928.13319@Think.COM> Sender: news@crl.dec.com (USENET News System) Reply-To: halbert@crl.dec.com Organization: DEC Cambridge Research Lab Lines: 32 [reposted with wrapped lines - sorry] The DEC Trellis language provides multiple inheritance. We coded the programming environment for Trellis in Trellis, and found multiple inheritance to be very useful. However, most uses are not of the Teacher/Student type of combination, where two conceptually "equal" types are merged. Instead, we usually use multiple inheritance to guarantee that a certain type will obey some protocol, ancillary in nature. For example, a number of the basic data types provided in the Trellis type library are subtypes of the abstract types Readable and/or Printable, which define operations for reading and writing representations of these types to and from streams. Another common ancillary abstract type is Hashed, which defines an operation that returns an Integer hash value for an object. Integer, for instance is a subtype of both Readable and Hashed (Readable is a subtype of Printable). In our window system code, we also used multiple inheritance. We call widget-like objects "frames". Some frames, in addition to their mainline inheritance, are subtypes of type Selector, which means they display things which can be selected (e.g. text or lists). These ancillary abstract types define operations, but often don't provide implementations for them, or provide a general purpose implementation. If there is no implementation, it is up to the subtypes that inherit them to provide implementations. The Trellis compiler checks that non-abstract types have implementations for all defined operations. --Dan Halbert