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: Adam.Morris@octacon.co.uk (Adam Morris) Subject: Re: on OO differnces between Ada95 and C++ Date: 1996/02/27 Message-ID: <4gveoa$nnd@mulgave.octacon.co.uk>#1/1 X-Deja-AN: 141411312 references: <4gbq7q$g08@qualcomm.com> <4gdidj$10f5@watnews1.watson.ibm.com> organization: Octacon Ltd newsgroups: comp.lang.ada,comp.lang.c++ Date: 1996-02-27T00:00:00+00:00 List-Id: In article <4gdidj$10f5@watnews1.watson.ibm.com>, ncohen@watson.ibm.com (Norman H. Cohen) wrote: >In article <4gbq7q$g08@qualcomm.com>, nabbasi@qualcomm.com (Nasser Abbasi) >observes that in C and C++ one specifies an interface in a .h (or .H) >file and imports the interface with a #include directive, while in Ada >one specifies an interface with a program-unit declaration (typically a >package declaration) and imports it with a with clause. In C and C++ >importing is transitive--if B #includes A and C #includes B, then C has >effectively #included--while in Ada it is not--if B has a with clause for >A and C has a with clause for B, then A is not visible in C unless C has >its own explicit with clause for A. Only if you do what you shouldn't do... the .h file should have forward declarations of all classes it uses except in certain cases. And what are those cases, if A inherits from B then (and only then as far as I know) should you #include B.h in A.h otherwise you have a declaration saying class B{}; you #include B.h in the .cc file this means that A.cc knows about B.h but C.cc will only know about B.h if it has included A.h AND A is derived from B. Adam.