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,1bd4be3f778193f9,start X-Google-Attributes: gid103376,public From: Simon Johnston Subject: Re: on OO differnces between Ada95 and C++ Date: 1996/02/26 Message-ID: <199602260835.IAA21916@jerry.rb.icl.co.uk>#1/1 X-Deja-AN: 141189754 sender: Ada programming language priority: normal comments: Authenticated sender is content-type: text/plain; charset=US-ASCII organization: ICL Retail Systems mime-version: 1.0 reply-to: skj@acm.org newsgroups: comp.lang.ada x-mailer: Pegasus Mail for Windows (v2.22) Date: 1996-02-26T00:00:00+00:00 List-Id: > ...YET ANOTHER RELIGIOUS WAR... Lets hope not. > Pete Becker wrote: > > > >#define private public // *** BERK! *** > > >#include "...h" // second definition for the same class > > >#undef private > > > > This is not true. A program that attempts to do this violates the one > > definition rule, so it is not a legal C++ program. > > Pete, > > What is this "one definition rule"? Could you point me to the > appropriate C++ Draft Standard location? [snip] > The whole program contains two definitions for the same classes Shape > and Rectangle: for each, one definition with attributes private and > another definition with everything public. The whole program does, the point is that no one single compilation stream must include more than one definition for a given entity. > It seems that in C++, every encapsulation can be legally broken, > essentially because of _independent_ compilation that allows > redefinitions of the same class. > > Ada compilation model is different: it's _separate_ compilation. > Impossible in Ada to have a redefinition in the same program: it's > detected at compile-time. If something is checked in C++, it's deferred > to link-time (for example a redefinition of the same class that will > clash because the two constructors will have the same name). > > > Read also "The design and evolution of C++" by Bjarne Stroustrup, > chapter 17 "Namespaces", section 3 "Ideals for a solution": Ada has a > more complete solution than C++. > > The basic property of OO languages is encapsulation. According to this > criteria, C++ fails. > > Non mais enfin, quoi ! > > > Jerome. > > with StandardDisclaimer; use StandardDisclaimer; package Sig is --,-------------------------------------------------------------------------. --|Simon K. Johnston - Development Engineer (C++/Ada95) |ICL Retail Systems | --|-----------------------------------------------------|3/4 Willoughby Road| --|Unix Mail: skj@acm.org |Bracknell | --|Telephone: +44 (0)1344 476320 Fax: +44 (0)1344 476302|Berkshire | --|Internal : 7261 6320 OP Mail: S.K.Johnston@BRA0801 |RG12 8TJ | --|WWW URL : http://www.acm.org/~skj/ |United Kingdom | --`-------------------------------------------------------------------------' end Sig;