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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b6619eb9cada212 X-Google-Attributes: gid103376,public From: Chris Powell Subject: Re: Help me to chose between ADA 95 and C++ Date: 1999/12/23 Message-ID: <3861F93C.5CA3A89B@rdel.co.uk>#1/1 X-Deja-AN: 564383266 Content-Transfer-Encoding: 7bit References: <01bf37fb$a91afb60$0564a8c0@IS-D2D04C.test> <829rbv$a8m$1@nntp6.atl.mindspring.net> <01bf3e32$0b9dc880$022a6282@dieppe> <385112AE.7E2CFA9@rdel.co.uk> <3855e3cd_1@news1.prserv.net> <38561A6C.5DE3D901@rdel.co.uk> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: postmaster@rdel.co.uk X-Trace: rdel.co.uk 945944919 28382 172.16.10.14 (23 Dec 1999 10:28:39 GMT) Organization: Blackbox Software UK Ltd Mime-Version: 1.0 Reply-To: chris@rrds.co.uk NNTP-Posting-Date: 23 Dec 1999 10:28:39 GMT Newsgroups: comp.lang.ada Date: 1999-12-23T10:28:39+00:00 List-Id: Stephen Leake wrote: > Hmm. I don't see why Dispatching_Method should _want_ to re-dispatch. > You could simply override Dispatching_Method, in addition to > Another_Dispatching_Method. Can you give a good example of when this > is not a good idea? My example was too simple. In reality, Dispatching_Method would perform some other functionality as well as calling Another_Dispatching_Method. Overriding Dispatching_Method would mean this behaviour would need to be reimplemented in the derived class, probably via cut and paste. > > Passing 'This' as an access parameter is common (since references to > > objects are often stored by an object, but further complicates the > > syntax. > > No problem here. The syntax is complicated (I assume you are refering > to "Object'Class (This.all)'Access") because you are doing things the > hard way; just override Dispatching_Method. No, I only write the same bit of code once: in the base class. > In Ada, you have complete control over whether a call dispatches or > not. If the actual parameter is class-wide, you get dispatching. > Otherwise, you get static binding. Static binding is a Good Thing in > some situations; I'm not clear you ever get it in C++. Yes C++ has both. The difference is that C++ uses dynamic binding by default and Ada uses static. > C++ uses "object.method". Ada uses Method (object). Same logical > association. Hmm, if you have more parameters, and don't put the > object first in Ada, you might lose something. Once again, Ada gives > you a choice, C++ doesn't. C++ does allow binary methods which are defined outside a class, so in fact it is C++ which gives you the choice, and Ada which does not. Chris.