From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,c890e6ab3fb2c5fc X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,c890e6ab3fb2c5fc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-23 10:08:17 PST Newsgroups: comp.lang.ada,comp.lang.c++ Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!csn!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!milod From: milod@netcom.com (John DiCamillo) Subject: Re: calling syntax (was Re: Ada Objects) Message-ID: Organization: NETCOM On-line Communication Services (408 261-4700 guest) References: <3f9g1u$j4m@nps.navy.mil> <3flk3r$8qj@gdls.com> <1995Jan23.101143@lglsun.epfl.ch> Date: Mon, 23 Jan 1995 18:08:17 GMT Xref: nntp.gmd.de comp.lang.ada:18218 comp.lang.c++:87697 Date: 1995-01-23T18:08:17+00:00 List-Id: nebbe@lglsun.epfl.ch (Robb Nebbe) writes: >In article <3flk3r$8qj@gdls.com>, wilkinso@gdls.com (Robert M. Wilkinson) writes: >|> In article , >|> Kenneth Almquist wrote: >|> > >|> >C++ has two procedure calling syntaxes. It is possible to write either >|> > display(myptr); >|> >or >|> > myptr->display(); >|> >|> Please note that these have *entirely* different semantics; they are not >|> merely "two forms of syntax" for the same thing. >|> >I'm not sure you would want to call this a semantic difference. The >semantics are the operation display is called with the parameter >myptr in both cases. The semantic difference is not in the calling sequence, but in the display operation itself. The member function display has access to the internals of the class; the global function display does not. It seems to me (I'm no expert) that Ada95 does not need (or provide) the member function concept because Ada separates the notions of type and visibility. >The real difference is in the implementation. The >first is just a normal function call like you would find in C (or Ada) >in the second the parameter is called "this" inside the function >and if it is virtual (and the compiler can't be sure exactly what the >pointer points at) then the implementation will be chosen at run-time, >otherwise it is called just like a normal function. All correct. (Of course, Ada95 provides dynamic dispatch as well, it just uses similar syntax as for static dispatch.) -- ciao, milo ================================================================ John DiCamillo Pinin' for the fjords? milod@netcom.com What kind of talk is that?