Each instance of a class has a different set of
a) Methods
b) Data members
c) Static members
d) None of the above
Answer:
b) Data members
Explanation:
Each instance (object) of a class in C++ has its own set of data members, which are independent of those in other instances. This allows each object to maintain its own state. However, all instances of the class share the same methods and static members. Static members are shared across all instances, meaning there is only one copy of each static member, regardless of how many objects are created.
Understanding how data members and static members behave in different instances is important for managing state and behavior in object-oriented programming.