In C++ terminology, which entity is also known as an instance of a class? Select the most accurate term used in object-oriented programming.

Difficulty: Easy

Correct Answer: Object

Explanation:


Introduction / Context:
Object-oriented programming distinguishes between a class (the blueprint) and its concrete realizations. The question asks for the standard term for a concrete realization of a class.



Given Data / Assumptions:

  • Classes define data members and member functions.
  • At runtime or during execution, concrete entities are created from classes.
  • We seek the canonical term for such concrete entities.



Concept / Approach:
An object is an instance of a class. It occupies memory, maintains state, and supports operations (methods) defined by its class. Multiple objects can be instantiated from the same class, each with its own state.



Step-by-Step Solution:
1) Define a class, e.g., class Point { int x, y; };2) Create instances: Point p1; Point p2;3) p1 and p2 are objects (instances) of Point, each storing its own x and y.4) Methods operate on these objects to read/modify state.



Verification / Alternative check:
Consult any OOP primer: “class = blueprint, object = instance”. The standard library types (std::string, std::vector) are classes; variables of these types are objects.



Why Other Options Are Wrong:
Friend functions: free or member-like functions granted special access, not instances.Member functions/variables: components of a class/object, not the instance itself.Namespace: a scope construct, not an instance.



Common Pitfalls:
Calling classes “objects” or vice versa; remember a class describes behavior and structure, an object embodies them at runtime.



Final Answer:
Object


Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion