What is the term for a variable that references an instance of a class?
2025
What is the term for a variable that references an instance of a class?
- A.
Property
- B.
Method
- C.
Object
- D.
Constructor
Attempted by 206 students.
Show answer & explanation
Correct answer: C
In Object-Oriented Programming (OOP), an object is an instance of a class. A variable that stores or references an instance of a class is called an object.
Example:
class Student
{
};
Student s1;Here:
Studentis a classs1is an object of the classStudent
The variable s1 references an instance of the class.
Therefore, the correct term is Object.