home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
- From: jbn@lulea.trab.se (Johan Bengtsson)
- Newsgroups: comp.lang.c++
- Subject: Re: Should I use a generic object which all others inherit from
- Message-ID: <5242@holden.lulea.trab.se>
- Date: 20 Nov 92 11:39:47 GMT
- References: <1992Nov19.165529.23862@informix.com>
- Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
- Lines: 68
- X-Newsreader: Tin 1.1 PL4
-
- cshaver@informix.com (Craig Shaver) writes:
- : In article <5232@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
- : >cshaver@informix.com (Craig Shaver) writes:
- : >: In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
- : ....... blah blah blah
- : >: performance go all the way and use the tree approach as pioneered by
- : ........ blah blah blah
- : >:
- : >: One of the big wins of OOP is reuse. By using an inheritance structure
- : >: you can reuse existing code and do incremental development. Related and
- : >: unrelated classes can be used in the same context where a similar protocol
- : >: is enforced.
- :
- : >
- : >If I go for the tree approach, with a base class MyObject inherited
- :
- : YourObject is worthless, just use MyObject....
-
- Yes, but from my point of view... (:-)
-
- : >by all my classes, how am I going to reuse _your_ classes, which all
- : >inherit from class YourObject? Multiple inheritance? What
- :
- : Use delegation instead of MI ...
-
- OK, that works (I won't mention performance).
-
- : >How do I reuse tree-type libraries from several sources, each with
- : >it's own base class protocol?
- :
- : You don't! C++ bites it bigtime because of a lack of the one thing
- : that would really make it good -- a standard base class library.
-
- Agreed, but you may want to use a few non-standard but nevertheless
- good libraries. Besides, standards are relative things. You don't
- always need to adhere to worldwide standards, sometimes standard
- libraries within a corporation is enough. Easy combination of the
- corparations standard libraries with commercial libraries is an import
- issue, I imagine.
-
- : >Enforcing a common protocol (by inheritance) for all your classes,
- : >_hampers_ reuse of your classes by anyone except yourself.
- :
- : Hold on there pardner! Start your own branch if you don't like mine.
- : Trim the damn tree, make sure you have access to all source for classes.
-
- Yes, if you are prepared to use the old hack-it-in-the-editor approach
- to reuse, then sure, no problem. Updates of the reused classes will
- be a pain to handle for you. Being able to reuse without source
- code changes to working code is a major advantage of O-O languages.
- Do you want to throw that away?
-
- : This statement sounds bogus. What is your point?
-
- Let others work for you. Reuse without touching their code, even
- if you have it (bugs aside).
-
- : >Once a reference to an object has been passed as a generic
- : >object reference, for example into a collection, how do you (safely)
- : >call the actual methods of the objects (derived) class?
-
- You didn't answer on that one...
-
- --
- --------------------------------------------------------------------------
- | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden |
- | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490 |
- --------------------------------------------------------------------------
-