Class in OOP | C++ :

  • A Class is a group of similar objects.
  • It is a blueprint or template form which objects are created.
  • It represents the set of properties that are common to all the objects of one type.
  • A class specification has two parts-
          1) Private
          2) Public
  • Private data can be accessed only within the Class.
  • Public data can be accessed from outside the Class.
  • The Keyword ‘Private’ is optional. By default, Class Members are private.
  • Each part has two types of elements-
          1) Data Member
          2) Member Function
  • The Variables (data member) and Functions (member function) are collectively known as Class Member.  
  • General form of Class declaration-

    class class_name
    {
       Private:
          Data member;
          Member function;
       Public:
          Data member;
          Member function;
    };