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: Mark A Biggar Subject: Re: Ada OO Mechanism Date: 1999/05/25 Message-ID: <374AC676.F7AE0772@lmco.com>#1/1 X-Deja-AN: 481943115 Content-Transfer-Encoding: 7bit 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> Organization: Lockheed Martin Western Development Labs Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-25T00:00:00+00:00 List-Id: Ole-Hjalmar Kristensen wrote: > > David Starner writes: > > > bob wrote: > > > > > > In article <3749E9EC.2842436A@aasaa.ofe.org>, David says... > > > > > > > > > > >Think of vectors and the dot product. C++ forces you to view one vector > > > >as significant (a becomes "this" inside dot function, it's called > > > >a.dot(b)), even though in a dot b, a and b are equal significance - dot > > > >product is a symmetric function. Ada makes them of equal importnatce in > > > >the dot function body and call. > > > > > > Are sure you are not talking about Java (which does not have user defined > > > operators) ? > > Yes. I was discussing a.dot(b) vs. dot(a,b), not user defined operators. > > > > > What makes you think you cannot implement dot(a,b) in C++? You can, but there are some problems with doing that. 1) It's not really part of the class as it has to be defined as an external "friend" function. 2) It therefore CANNOT be made virtual so you can't dispatch on it. 3) This also greatly complicates its use in generic (template) algorithms. None of those problems exist in Ada. -- Mark Biggar mark.a.biggar@lmco.com