comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@home.com>
Subject: Re: C++ virtual function mechanism in Ada ?
Date: Wed, 25 Jul 2001 16:10:11 GMT
Date: 2001-07-25T16:10:11+00:00	[thread overview]
Message-ID: <3B5EEF62.6BA4104B@home.com> (raw)
In-Reply-To: 9jmif2$et3$1@s1.read.news.oleane.net

Jean-Pierre Rosen wrote:
> 
> "Didier.pieroux" <dpieroux.no-spam@pi.be> a �crit dans le message news: IDz77.6315$ar1.18443@www.newsranger.com...
> [snipped for brievity]
> 
> > One way to get the job done is to use:
> > procedure F(A: in T1) is begin Put("F1:");     E(T1'Class(A)); end F;
> > That switches the dynamical dispatching on and everybody is happy. But the bad
> > point is that I have the impression that extending a base type can require
> > modifications in that base type implementation. Too bad for code reliability,
> > isn't it ?
> This is the right way to do it.
> 
> >
> > So, my first question is: knowing that a characteristic feature of primitive
> > operations is to call them with objects of a derived type, why did the Ada
> > designers choose not to use dynamical dispatching when calling a primitive
> > function ?  I guess that most of the time Ada programmers (as C++ programmers)
> > want to really call the primitive operation corresponding to the type of the
> > actual parameter, no ?
> A fundamental question, so let's go.
> There is a fundamental difference between C++ and Ada: in C++, dispatching is a property of the function (virtual or not).
> Second: Ada is a language driven by types. It is always the *type* of the parameters that determines what is called. 

Don't forget that in Ada95, the return value type can also be important ;-)

C++ does not dispatch on the return type.

-- 
Warren W. Gay VE3WWG
http://members.home.net/ve3wwg



  reply	other threads:[~2001-07-25 16:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25 13:15 C++ virtual function mechanism in Ada ? Didier.pieroux
2001-07-25 13:43 ` Jean-Pierre Rosen
2001-07-25 16:10   ` Warren W. Gay VE3WWG [this message]
2001-07-25 15:49 ` Larry Kilgallen
2001-07-26  2:00   ` DuckE
2001-07-26  3:14     ` Larry Kilgallen
2001-07-26 10:44       ` Robert Dewar
2001-07-26 12:52         ` Dmitry A. Kazakov
2001-07-26 17:18           ` Ted Dennison
2001-07-28  2:10           ` Robert Dewar
2001-07-30  8:09             ` Dmitry Kazakov
2001-07-26 12:57         ` Larry Kilgallen
2001-07-26 10:38   ` Robert Dewar
2001-07-26 17:31     ` Warren W. Gay VE3WWG
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox