Re: Multiple Inheritance (not Marathon Infinity)
Re: Multiple Inheritance (not Marathon Infinity)
- Subject: Re: Multiple Inheritance (not Marathon Infinity)
- From: Howard Oakley <email@hidden>
- Date: Thu, 06 Dec 2001 19:29:50 +0000
On 6/12/01 0:23, "Rosyna" <email@hidden> wrote:
>
If I have this right, Multiple Inheritance is the ability for a class
>
to inherit from multiple parent classes that do not necessary inherit
>
or derive from eachother. Like iostream.h inherits from istream and
>
ostream. Is this correct?
Yes - that's an accurate illustration.
>
If this is correct, I present something.
>
>
Since Objective C does not support MI, doesn't this cause problems
>
with things like NSTextField? It's parents (Path: :NSControl :
>
NSView : NSResponder : NSObject) never inherit from NSText. So,
>
as a workaround we have a/an -(id)cell method in NSControl which
>
returns an instance of some NSText child class that has been
>
initialized. Is this correct?
>
>
This seems to lead to some redundantly declared methods in each class
>
and some confusion about how to access some properties of
>
NSTextField. Would not this specific "problem" be "fixed" if MI
>
existed in Objective-C?
There are different techniques for addressing such issues. Having used
languages with and those without MI, you quickly learn that MI is not
*required*, as there are ways of designing similar results without it.
However, there is something ultimately cool about designing for MI, being
able to inherit from 2 or 3 classes to produce a new class that is precisely
functional with minimal additional methods. C++ has never impressed me in
this respect, in that most use of MI that I have seen in C++ does look
kludgy. But that probably reflects the coder rather than the language. Other
languages with good MI such as Common Lisp (CLOS) seem to result in truly
elegant results (once you can see past the parentheses).
Howard.
Dr Howard Oakley * M1BWR: QRV on 2, 4 & 6 m SSB
EHN & DIJ Oakley * Internet email@hidden
Brooklands Lodge * CompuServe 70734,120
Park View Close *
http://www.quercus.demon.co.uk
Wroxall, Ventnor * voice +44 1983 853605
Isle of Wight, PO38 3EQ, UK * fax +44 1983 853253