home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Multiple Inheritance - Necessary?
- Message-ID: <By1HqH.21q@cs.uiuc.edu>
- Keywords: c++ inheritance
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <By17An.4uH@usenet.ucs.indiana.edu>
- Distribution: usa
- Date: Sat, 21 Nov 1992 00:08:40 GMT
- Lines: 40
-
- In <By17An.4uH@usenet.ucs.indiana.edu> ezachris@iroquois.ucs.indiana.edu writes:
-
- >A friend of mine who programs in Objective-C argues that multiple
- >inheritance is unnecessary and complicated.
-
- *****> S/He doesn't _have_ to use it if s/he doesn't understand it.
- It's useful when you need it; useless otherwise. (This state-
- ment is true of everything.)
-
- >Let's say you have a pencil-object and an eraser-object and to create a
- >pencil-with-an-eraser-on-it you'd inherit from both the pencil and the
- >eraser object, right?
-
- *****> I wouldn't (this is a bad example, IMHO). A pencil-with-eraser
- is-a pencil but it isn't-an eraser. I would derived pencil-with
- -eraser from pencil that has-an eraser.
-
- >My Objective-C friend would make a new object "Pencil-with-eraser" that
- >would declare two objects inside it.
-
- >Like this:
-
- > PENCIL-WITH-ERASER
- > Eraser TheEraser(...);
- > Pencil ThePencil(...);
-
- >To implement the functionality of the pencil and the eraser he'd write a
- >bunch of functions that call the functions inside the pencil and the
- >eraser objects.
-
- *****> Then a pencil-with-eraser can not be used in all places a pencil
- can since it's not derived from it.
-
- >I think this sounds like hogwash. What do you think?
-
- *****> Hogwash. MI, like all things, has its place.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-