[comp.lang.c++] "Classes are the central concept in C++"

gnu@hoptoad.uucp (John Gilmore) (06/02/89)

ark@alice.UUCP (Andrew Koenig) wrote:
> Classes are the central concept in C++; it is important to
> make them as easy to use as possible.

My initial reaction is that this is not true.  As rebuttal:  What
is the "central concept" in C?  None immediately springs to mind; there
are a bunch of concepts that all contribute.  C++ inherits 99% of those
concepts from C; does the existence of classes render the rest
inconsequential?

Classes are certainly the most central NEW thing in C++ (as opposed to C);
but that is very different.
-- 
John Gilmore    {sun,pacbell,uunet,pyramid,amdahl}!hoptoad!gnu    gnu@toad.com
  A well-regulated militia, being necessary to the security of a free State,
  the right of the people to keep and bear arms, shall not be infringed.

jss@hector.UUCP (Jerry Schwarz) (06/02/89)

In article <7508@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes:
>ark@alice.UUCP (Andrew Koenig) wrote:
>
>My initial reaction is that this is not true.  As rebuttal:  What
>is the "central concept" in C?  None immediately springs to mind; there
>are a bunch of concepts that all contribute.  C++ inherits 99% of those
>concepts from C; does the existence of classes render the rest
>inconsequential?
>
>Classes are certainly the most central NEW thing in C++ (as opposed to C);
>but that is very different.

In this, and other postings, John seems to be advocating the idea C++
is just C with some extensions.  (I apologize in advance if  this
misrepresents his views. The postings leave make this impression very
strongly on me.)  In some sense, I suppose, this is true, but as an
experienced C++ programmer I do not feel it does justice to C++. It
is unclear from John's postings how much experience he has had with
C++.

For example, I think John suggested recently that

        typedef struct K K ;

was both good C and good C++. But my first thought is that this must
be code that was originally written in C, or  its found in a header
file intended for use with both C and C++. In C++ it is as peculiar
as

        if ( NULL == 0 ) ...

would be in C.  Not wrong, but very peculiar.

My experience (and I believe that of others) is that it takes a while
after switching to C++ to starting thinking  "like a C++ programmer".
Designing a C++ program isn't just a matter of using C++ to implement
a design that you might have implemented in C. C++ classes make
available design strategies that would be awkward or unwieldy in C.

C classes are indeed "central concept" in C++.  The first and most
important question about C++ code is almost always what classes are
there and how are values and objects of that class used.

Jerry Schwarz
AT&T Bell Labs, Murray Hill

leech@Apple.COM (Jonathan Patrick Leech) (06/02/89)

In article <7508@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes:
>ark@alice.UUCP (Andrew Koenig) wrote:
>> Classes are the central concept in C++; it is important to
>> make them as easy to use as possible.
>My initial reaction is that this is not true.
>...
>Classes are certainly the most central NEW thing in C++ (as opposed to C);
>but that is very different.

	If someone asks me why I would use C++ instead of C, the answer
is the class mechanism. In this sense, I agree that classes are what C++
is all about. The other stuff is nice but not enough motivation.

    Jon Leech (leech@apple.com)
    Apple Integrated Systems
    __@/