Specifying a Class

A class is a way to bind the data and its associated functions together. It allows the data (and functions) to be hidden, if necessary, from external use. When defining a class, we are creating a new abstract data type that can be treated like any other build-in data type.
Generally, a class specification has two parts:
1. Class declaration
2. Class function definitions

The class declaration describes the type scope of its members. The class function definitions describe how the class functions are implemented.

The general form of a class declaration is:
class class_name
{
private:
variable declaration;
function declaration;
public:
variable declaration;
function declaration;
};

3 comments: