home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mole-end!mat
- From: mat@uunet.uu.net!mole-end
- Subject: Re: Language extensions for run-time type identification
- Message-ID: <1992Jul24.063825.1395@uunet.uu.net!mole-end>
- Organization: :
- References: <14ft2uINNjh4@agate.berkeley.edu> <rmartin.711829160@thor>
- Date: Fri, 24 Jul 1992 06:38:25 GMT
- Lines: 42
-
- In article <rmartin.711829160@thor>, rmartin@thor.Rational.COM (Bob Martin) writes:
- > shang@corp.mot.com (David (Lujun) Shang) writes:
-
- > |In article <14ft2uINNjh4@agate.berkeley.edu> jbuck@forney.berkeley.edu (Joe
- > |Buck) writes:
- > |
- > |> * ... it is trivial to force any class ... to have a virtual function
- > |> * table (simply add a virtual destructor).
-
- > |Adding something virtual just for the purpose that has nothing to do with it?
-
- > Posh! Every class should have a virtual destructor. It is insane not
- > to declare the destructor virtual. There is only one, small,
- > exception to this rule, which has to do with structs placed in ROM...
-
- I don't quite agree with you, Bob. Any class for which polymorphic
- behavior may be desirable should have a virtual destructor. Polymoprhic
- behavior is not tacked on; it must be designed in. And there is a use
- of classes for which run-time polymorphism makes little sense: classes
- that represent quantity, quality, or selection. Included in this
- group are `arithmetic' and `geometric' types like Complex, Point,
- Rectangle (or their templatized versions), types representing homogeneous
- coordinates, transformations, etc., types which represent qualities in
- multidimensional space (e.g. an RGB or CMYK description of a color),
- and classes which are used as sophisticated versions of enum .
-
- There's another group of classes for which polymorphic behavior makes
- little sense: those that are used to implement or provide data structures
- (lists, trees, etc.)
-
- Oh, and there's a difference between the classes which have `information'
- nature (quantity, quality, selection) and classes which implement data
- structures: the former are based in the problem domain and identified in
- analysis; the latter are based in the solution (programming) domain and
- introduced during design.
-
- But that's another pot of pointer stew entirely.
- --
- (This man's opinions are his own.)
- From mole-end Mark Terribile
-
- uunet!mole-end!mat, Somewhere in Matawan, NJ
-