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: 109fba,9ac62ca34a465706 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,9ac62ca34a465706 X-Google-Attributes: gid103376,public From: ddavenpo@redwood.hac.com (Darren C Davenport) Subject: Re: on OO differnces between Ada95 and C++ Date: 1996/02/26 Message-ID: <4gspen$ot0@hacgate2.hac.com>#1/1 X-Deja-AN: 141242239 references: <4gbq7q$g08@qualcomm.com> <3129F185.41C6@Rational.COM> <4gi413$qo1@druid.borland.com> organization: Hughes Aircraft Company followup-to: comp.lang.ada,comp.lang.c++ newsgroups: comp.lang.ada,comp.lang.c++ Date: 1996-02-26T00:00:00+00:00 List-Id: Pete Becker (pete@borland.com) wrote: : In article <3129F185.41C6@Rational.COM>, jDesquilbet@Rational.COM says... : > : >- you may have several different definitions for the same class in the : >same program, as long as they are never compiled together in the same : >compilation unit; example: : > : >#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 We need to be careful here with terms used to describe C++ constructs. A class name declaration is a C++ declaration (ARM C++ 3.1) not a definition. This is what is specified in ".h" files. There can be multiple declarations so the above code is legal C++ code. There can only be one definition of each object, function, class, and enumerator in a program and these are specified in ".cc" files. Mr. Becker is correct about stating that there must be only one definition but that rule does not apply in this instance. Darren Davenport