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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c890e6ab3fb2c5fc X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,c890e6ab3fb2c5fc X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 1995-01-19 03:57:47 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!gatech!swrinde!pipex!uunet!heifetz.msen.com!ilium!gdls.com!gdls.com!not-for-mail From: wilkinso@gdls.com (Robert M. Wilkinson) Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: ADA Objects Help! Date: 19 Jan 1995 06:57:47 -0500 Organization: General Dynamics, Land Systems Division Message-ID: <3flk3r$8qj@gdls.com> References: <3f9g1u$j4m@nps.navy.mil> NNTP-Posting-Host: gdls.com Xref: nntp.gmd.de comp.lang.ada:18116 comp.lang.c++:87298 Date: 1995-01-19T06:57:47-05:00 List-Id: 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. >These both call a procedure, passing the value myptr as the argument. >In contrast, Ada provides only a single procedure call syntax. > >When you declare a procedure in C++ you specify which syntax will be >used to call the procedure. Again, there is much more to it than just the syntax. One is a member function, the other is a plain-old function. Big, big, difference. >As a result, having the two syntaxes >provides the following functionality: > >1. Both Ada and C++ provide overloading, but in C++ it is possible for > two overloaded routines to have the same argument types as long as > the calling syntax is different. The two calls to "display" which > appear above call different routines. Of course they do. One calls a member function, the other does not. Think of it as calling two functions with the same signature, but residing in different packages. >2. If you establish a suitable convention, the choice of calling syntax > can be used to convey additional information about the procedure. I > haven't been able to devise a useful convention, but that doesn't mean > that a useful convention does not exist. It is not a question of convention at all. >My own opinion, formed before I knew anything about Ada 9X, is that this >functionality is not useful, and thus having two syntaxes increases the >complexity of the language without providing any corresponding benefit. Perhaps you need a better C++ book. If you cannot see the need for member functions, which is the heart and soul of C++, then you definitely do not understand the language. -- ____________________________________________________________________________ Rob Wilkinson wilkinso@gdls.com ____________________________________________________________________________