OOP Interview Question

What is the difference between a class and an object?

Updated 2026-08-16 · Beginner friendly
Quick answer

A class is a blueprint or template that defines what data and behaviour a type has. An object is a real instance of that class created in memory. The class is the design, and the object is the actual thing built from that design. One class can create many objects.

Key takeaways
  • A class is a blueprint that defines what data and behaviour a type has.
  • An object is a real instance of that class created in memory, and one class can make many objects.
  • Each object holds its own copy of the data, so changing one does not affect another.

The blueprint idea

Think of a class like the architectural plan for a house. The plan lists the number of rooms and the layout, but you cannot live in a plan. An object is the real house built from that plan. From one plan you can build many houses, and from one class you can create many objects.

class Car {          // class: the blueprint
public:
    string model;
    void drive() { cout << "driving"; }
};

Car car1;               // object 1
Car car2;               // object 2
car1.model = "Tesla";
car2.model = "Honda";
class Car {          // class: the blueprint
    String model;
    void drive() { System.out.println("driving"); }
}

Car car1 = new Car();   // object 1
Car car2 = new Car();   // object 2
car1.model = "Tesla";
car2.model = "Honda";
class Car:              # class: the blueprint
    def drive(self):
        print("driving")

car1 = Car()            # object 1
car2 = Car()            # object 2
car1.model = "Tesla"
car2.model = "Honda"

Here Car is the class. The variables car1 and car2 are two separate objects. Each object has its own copy of the data, so changing car1 does not affect car2.

Quick comparison

In the interview

Interviewers like a crisp one liner here. Say a class is a blueprint and an object is a real instance built from it, then give the house plan example. Mentioning that objects hold their own copy of the data shows you understand memory.

Frequently asked questions

Can a class exist without any object?

Yes. A class is just a definition and can exist on its own. It only uses memory for its data when you create objects from it.

What does the new keyword do?

It allocates memory for a new object, runs the constructor to initialise it, and returns a reference to that object.

Want the full OOP guide?

Read every OOP concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the OOP guide All OOP questions