O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

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

Defining Classes

The C++ language also introduces the class mechanism. This provides you with an object-oriented mechanism for defining abstractions of objects. These abstractions adhere to OO principles such as data hiding (encapsulation), inheritance, and polymorphism.

In other words, you can define abstract data types where you know the exposed interface, but not the internals, and can only access the data in a way that is allowed by the class definition. Classes are ideal for a number of tasks and are useful in cases where you want to define a user-defined data structure coupled with all its processing functions as a single entity.

You’ll no doubt find many uses for classes once you understand the mechanism that C++ provides. The basic structure ...

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