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?

  1. A.

    Property

  2. B.

    Method

  3. C.

    Object

  4. 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:

  • Student is a class

  • s1 is an object of the class Student

The variable s1 references an instance of the class.

Therefore, the correct term is Object.

Explore the full course: Bpsc