Understanding class and member function basics
A C++ class is a fundamental building block in C++ that allows a programmer to specify a user defined type, encapsulating related data and behaviors. A C++ class definition will contain attributes, operations, and sometimes methods. C++ classes support encapsulation.
Creating a variable of a class type is known as instantiation. The attributes in a class are known as data members in C++. Operations in a class are known as member functions in C++ and are used to model behaviors. In OO terms, an operation implies the signature of a function, or its prototype (declaration), and the method implies its underlying implementation or the body of the function (definition). In some OO languages, the term method is used more loosely to imply either the operation or its method, based on the context of usage. In C++, the terms data member and member function are most often used.
The prototype for a member function must be placed in a class definition...