Article View: net.lang.c++
Article #48Re: Structs/classes
From: ron crocker
Date: Mon, 03 Mar 1986 16:55
Date: Mon, 03 Mar 1986 16:55
27 lines
1474 bytes
1474 bytes
>
> .... I have one question, though: since classes are essentially structs,
> and structs can have member functions and private/public parts, why bother
> creating separate classes at all? Why not just extend the struct syntax
> with the things you've got for classes - derivation, etc.?
"By definition, a struct is simply a class with all members public,
that is
struct s { ...
is simply shorthand for
class s { public: ...
Structures are used when data hiding is inappropriate."
By the above definition, a "struct" type is not necessary per se,
and no one is forcing you to use them. I think that they add to the
"compatibility" of C and C++. By calling something a "class"
implies the use of the data hiding features; calling something a
"struct" implies openness.
Ron Crocker
AT&T Bell Laboratories
Naperville-Wheaton Road
Naperville, IL 60566
(312) 979-4051
Views expressed are mine and not my employers.
Technical Details
Message-ID:
<742@ihwpt.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!ihwpt!crockerReferences:
<47900002@ccvaxa>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site ihwpt.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!ihwpt!crocker From: crocker@ihwpt.UUCP (ron crocker) Newsgroups: net.lang.c++ Subject: Re: Structs/classes Message-ID: <742@ihwpt.UUCP> Date: Mon, 3-Mar-86 11:55:40 EST Article-I.D.: ihwpt.742 Posted: Mon Mar 3 11:55:40 1986 Date-Received: Tue, 4-Mar-86 05:17:06 EST References: <47900002@ccvaxa> Organization: AT&T Bell Laboratories Lines: 27