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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5eb8ca5dcea2827 X-Google-Attributes: gid103376,public From: Hyman Rosen Subject: Re: Ada OO Mechanism Date: 1999/05/25 Message-ID: #1/1 X-Deja-AN: 482041004 Sender: hymie@calumny.jyacc.com References: <7i05aq$rgl$1@news.orbitworld.net> <7i17gj$1u1k@news2.newsguy.com> <7icgkg$k4q$1@nnrp1.deja.com> <3749E9EC.2842436A@aasaa.ofe.org> <7id2eo$fag@drn.newsguy.com> <3749FF7D.F17CE16A@aasaa.ofe.org> <374AC676.F7AE0772@lmco.com> <7ieuja$5v9@news1.newsguy.com> X-Complaints-To: abuse@panix.com X-Trace: news.panix.com 927665383 22922 209.49.126.226 (25 May 1999 20:49:43 GMT) Organization: PANIX Public Access Internet and UNIX, NYC NNTP-Posting-Date: 25 May 1999 20:49:43 GMT Newsgroups: comp.lang.ada Date: 1999-05-25T20:49:43+00:00 List-Id: Samuel Mize writes: > -- This dispatches on both parameters, so they have to match > -- at run-time > procedure Operation_4 (A: A_Type; B: B_Type); (Do you mean B: A_Type ?) Thanks, this is the kind of example I meant! This is something that C++ can't do by itself. When you say "match at runtime" do you mean that their dynamic types must be the same? Does the code raise an exception if they happen not to match? If I were to code this in C++, I could do the following: void Operation_4(A_Type &A, A_Type &B) { if (typeid(A) != typeid(B)) throw "Mismatched types!"; A.Operation_4(B); } The method Operation_4 of all subclasses of A_Type would have to be written to take a paremeter of type A_Type, so it's not nearly as nice as Ada, where I assume that this does not have to be the case. > Did you intend that paragraph to sound contentious? To my ear, > at least, it has rather a "you're all liars, I'm naming names" > sound to it -- I hope that isn't what you meant. I wanted it to sound somewhat contentious. The named people each claimed in a posting that there were object-oriented techniques that were harder, or less elegant, in C++ than in Ada. I asked for examples with the thought that perhaps the posters didn't know C++ as well as they knew Ada, and were therefore perhaps mistaken. There were responses, but no code, so I got a little testy.