In C++, a class is a mechanism for creating user-defined data types. A class is used to specify the form of an object and it combines data representation. The variables inside class definition are called as data members and the functions are called member functions.