Why are the data members of a class called instance variables
Answers
Answered by
0
The reason why data members of a class are called instance variables are as follows:
- In OOPs with classes, instance variables are defined in a class. Due to this instance variable, each object gets a distinct copy of its object.
- Though instance variables are not variables of a class, still there lies some resemblance between them.
- Instance variables are generally referred to as class attributes or data members
- Data members in a class might be in public, private, or protected.
- Thus data members are sometimes called instance variables.
#SPJ3
Similar questions