Chapter 2 Abstract Data Types and C++ Classes
2.1 CLASSES AND MEMBERS
A class is a new kind of data type. Each class that you define is a collection of data, and has the ability to include member functions. Member functions are incorporated into the class's definition and are designed specifically to manipulate the class.
PROGRAMMING EXAMPLE: The Throttle Class
class throttle
{
public:
// MODIFICATION MEMBER FUNCTIONS
void shut_off ();
void shift (int amount);
// CONSTANT MEMBER FUNCTIONS
double flow() const;
bool is_on() const;
private:
int position;
};
A class has some sections as follows :
The class head. The head of the definition consists of the C++ keyword class, followed by the name of the new class. </