October 1997
Intermediate to advanced
800 pages
20h 48m
English
C++ user-defined data types combine private members (state variables and private member functions) with public members (data members and member functions). The statement
struct Struct_name { private: . . . members . . . // Inside view public: . . . members . . . // Outside view };
defines the inside and outside views of a new data type called Struct_name. Although we have been working only with structures up to now, the following class definition is equivalent.
class Class_name { . . . members . . . // Inside view public: . . . members . . . // Outside view };
C++ classes are structures whose default access specification is private, making the private keyword optional. A class, therefore, is nothing more than a structure with ...