Class :
- The entire set of data and code of an object can be made of a user defined data type with the help of a class.
• In fact, Objects are variables of the type class. Once a class has been defined, we can create any number of objects belonging to that class.
• Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class. Thus a Class represents a set of individual objects.
7
• Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects become functions of the class and is referred to as Methods.
A class is thus a collection of objects of similar type . for example: mango, apple, and orange are members of the class fruit . ex: fruit mango; will create an object mango belonging to the class fruit.
Example for class
class Human
{
private:
EyeColor IColor;
NAME personname;
public:
void SetName(NAME anyName);
void SetIColor(EyeColor eyecolor);
};