comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Johnston <skj@ACM.ORG>
Subject: Re: on OO differnces between Ada95 and C++
Date: 1996/02/26
Date: 1996-02-26T00:00:00+00:00	[thread overview]
Message-ID: <199602260835.IAA21916@jerry.rb.icl.co.uk> (raw)

> ...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;




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

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-26  0:00 Simon Johnston [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-02-21  0:00 on OO differnces between Ada95 and C++ Christian Jaensch, FRG
1996-02-20  0:00 Nasser Abbasi
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
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 ` Robert I. Eachus
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 ` Jon S Anthony
1996-02-21  0:00 ` Darren C Davenport
replies disabled

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