O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.2. Classes

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required