comp.lang.ada
 help / color / mirror / Atom feed
From: Adam.Morris@octacon.co.uk (Adam Morris)
Subject: Re: on OO differnces between Ada95 and C++
Date: 1996/02/27
Date: 1996-02-27T00:00:00+00:00	[thread overview]
Message-ID: <4gveoa$nnd@mulgave.octacon.co.uk> (raw)
In-Reply-To: 4gdidj$10f5@watnews1.watson.ibm.com

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.




  parent reply	other threads:[~1996-02-27  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-20  0:00 on OO differnces between Ada95 and C++ Nasser Abbasi
1996-02-20  0:00 ` Jerome Desquilbet
1996-02-21  0:00   ` Robert Dewar
1996-02-22  0:00     ` Jerome Desquilbet
1996-02-24  0:00       ` Robert Dewar
1996-02-22  0:00   ` Pete Becker
1996-02-23  0:00     ` Jerome Desquilbet
1996-02-26  0:00     ` Darren C Davenport
1996-02-26  0:00       ` Pete Becker
1996-02-27  0:00         ` Nigel Perry
1996-02-20  0:00 ` Norman H. Cohen
1996-02-21  0:00   ` Mark A Biggar
1996-02-22  0:00     ` Norman H. Cohen
1996-02-27  0:00   ` Adam Morris [this message]
1996-02-20  0:00 ` Robert I. Eachus
1996-02-21  0:00 ` Jon S Anthony
1996-02-21  0:00 ` John English
1996-02-22  0:00   ` Nasser Abbasi
1996-02-26  0:00     ` John English
1996-02-27  0:00       ` Dale Stanbrough
1996-02-22  0:00   ` Gene Ouye
1996-02-26  0:00     ` John English
1996-02-21  0:00 ` Darren C Davenport
  -- strict thread matches above, loose matches on Subject: below --
1996-02-21  0:00 Christian Jaensch, FRG
1996-02-26  0:00 Simon Johnston
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox