Which of the following statements is correct about the class?
2023
Which of the following statements is correct about the class?
- A.
An object is an instance of its class.
- B.
A class is an instance of its object.
- C.
An object is the instance of the data type of that class.
- D.
More than one of the above
- E.
None of the above
Attempted by 295 students.
Show answer & explanation
Correct answer: A
In Object-Oriented Programming (OOP), a class is a blueprint or template used to create objects. An object is a real entity created from a class.
For example:
class Student
{
};Here, Student is a class.
Student s1;Here, s1 is an object (instance) of the Student class.
Therefore, the correct statement is:
“An object is an instance of its class.”