Class is a collection of different types of data elements and their associated behaviours or methods into a single unit. An object is an identifiable entity with some characteristics and behaviour. Suppose there is a class named Student, then the Student object also has some characteristics and behaviour. The behaviour of a Student object is described through the associated functions called methods. For example, name, age, class, marks and roll number are the data elements of a Student object and talking, learning, playing and reading can be considered as its functions. Classes are required to associate conventional functions with data structures and allow these functions to represent active elements of the real world.
An abstraction is a named collection of attributes and behaviour. Class is a named software representation for an abstraction. An object is a distinct instance of the given class that is structurally identical to all other instances of that class. For example, Student in real world possesses characteristics such as name, parents, address, marks, roll number, award, medical, talent etc., however, the abstraction of Student result tracking system possesses the following characteristics - name, marks and roll number.
Class acts as an object factory because it contains all the statements needed to create an object. It contains statements to describe the operations that the object will be able to perform. New objects can be created from the class as and when required. Any number of objects can be created for a class. These objects are called instances of that particular class. All the instances created in a class will have the same structure and behaviour.