Basic Class Syntax

The goal of introducing classes in C++ is to render support to the practices of object-oriented programming and eliminate the drawbacks caused by using smaller units of modularity: functions.

The first primary goal of the class construct is to bind together data and operations into one syntactical unit, and to indicate that these coding elements belong together. The next primary goal is to eliminate name conflicts so that data and functions in different classes can use the same names without clashes. The third important goal of the class construct is to allow the server designer to control access to class elements from the outside (from the client code). The fourth goal is to support encapsulation, information hiding, pushing ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.