What is the relation between object and class in an object-oriented programming?
2021
What is the relation between object and class in an object-oriented programming?
- A.
Object is keyword of class
- B.
Object is scope of class
- C.
Object is instance of class
- D.
Object is type of class
Attempted by 344 students.
Show answer & explanation
Correct answer: C
In Object-Oriented Programming (OOP), a class is a blueprint or template that defines properties and behaviors. An object is a real entity created from that class.
Therefore, an object is called an instance of a class.
Example:
class Car { };
Car c1;Here, Car is a class and c1 is its object (instance).