Up to this point in the chapter, the terms class and object have been used fairly interchangeably. However, classes and objects aren’t the same thing, and we need to clarify the differences between these terms. As the name implies, object- oriented programming is about objects. An object is composed of data that describes the object and the operations that can be performed on the object. However, when you create a program in C++, you declare and define classes, not objects.
A class is a user-defined type; it encapsulates both the data and the methods that work on that data. With the exception of static functions, you cannot use classes directly. A class is much more like a template, which is used to create (instantiate) objects. Just as you have to declare an int variable before you can use it, you also have to instantiate an object of the class before it can be used.
For example, you would not declare and define an Animal object. Instead, you would declare and define an Animal class and its attributes and methods. The class represents the concept, so the Animal class does not represent a specific animal but the class of all animals. When you want to use an Animal object, you have to instantiate an Animal object from the class. The class can be considered as the abstract representation of an entity, while the instantiation of the class—the object—is the concrete representation.