Class is a user-defined type. A class consists of members. The members are data members and member functions. A class can be described as data and some functionality on that data, wrapped into one. An instance of a class is called an object. To only declare a class name, we
write:To define an empty class, we add a class body marked by braces
{}:
To create an instance of the class, an object, we use:
Explanation
We defined a class called MyClass. Then we created an object o of type MyClass. It is said ...