Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel-eecis!gatech!rutgers.rutgers.edu!news.columbia.edu!panix!newsgate.nytimes.com!newsfeeds.sol.net!feed1.news.erols.com!howland.erols.net!news.sprintlink.net!news-peer.sprintlink.net!uunet!in3.uu.net!uucp3.uu.net!alexandria.organon.com!alexandria!jsa
From: jsa@alexandria (Jon S Anthony)
Subject: Re: What is wrong with OO ?
In-Reply-To: ell@access5.digex.net's message of 11 Feb 1997 03:42:42 GMT
Message-ID: <JSA.97Feb11200125@alexandria>
Followup-To: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng
Sender: news@organon.com (news)
Organization: Organon Motives, Inc.
References: <5dopri$dei@news4.digex.net>
Date: Wed, 12 Feb 1997 01:01:25 GMT
Lines: 44
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:247286 comp.lang.smalltalk:51439 comp.lang.eiffel:18366 comp.lang.ada:57452 comp.object:61030 comp.software-eng:53663

In article <5dopri$dei@news4.digex.net> ell@access5.digex.net (Ell) writes:

> Nick Leaton (nickle@calfp.co.uk) wrote:
> : richard@highrise.nl wrote:
> : > 
> : > Virtual functions are also a kind of documentation. When declaring a
> : > function virtual, the programmer is more or less saying "go ahead,
> : > override this function if you like."
> : > 
>  
> : The decision to make a function virtual assumes a knowledge of what
> : users of your class are going to do. It akin to predicting the future.
> : One of the problems with C++ is this very point. Should you, as a
> : designer of a class restrict what someone else does with your class?
> 
> How does making inherited classes able to override a parent function
> "restrict"ing "what someone else does with" that class"?

This seems really confused.  How are the _inherited_ classes
overriding a _parent's_ function?  I suppose you meant subclasses.
Anyway, you got it backwards.  The point is that if you don't make the
things virtual, you can't do the overrides (and other attendant
stuff).  So, there is this problem of either making everything
virtual, and possibly providing misleading, inappropriate or possibly
simply inefficient aspects, or not and then risking the mentioned
problems.

Nick is correct here.  This is a problem in C++ (along with
friendship) as it requires prescience on the part of the developer
and/or various maintenance problems: if you later decide it should be
virtual, you have to go back and _change_ the source of the parent
thereby changing the semantics in various other places.  If you decide
you need a new "friend" you have to go back and _change_ the source
(which you may not even have accesss to!)

/Jon

-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com

