Chapter 21. Understanding C++ Classes

<feature>
  • Discover C++ classes and class design

  • Learn to encapsulate data and functions into C++ classes

  • Understand the this pointer

  • Discover how to use constructors and destructors

  • See how to specify access to class members

</feature>

Creating C++ Classes

If there’s one thing that truly sets C++ head and shoulders above C, it’s got to be classes. C++ classes offer you an elegant, object-oriented solution to writing code that’s easy to maintain and modify. In procedural programming languages, you typically create data structures and write functions to manipulate them, but in C++, you can bind the functions to the data that the functions act on. The class is the cornerstone of object-oriented programming in C++. ...

Get Practical C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.