Home / Questions / Differentiate between static and non-static data members.
Explanatory Question

Differentiate between static and non-static data members.

👁 100 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • Static Data Members:

    • Shared among all instances of a class.
    • Only one copy exists for the entire class, regardless of the number of objects created.
    • Accessed using the class name.
  • Non-static Data Members:

    • Each object of the class has its own copy of non-static data members.
    • They are also known as instance variables.
    • Accessed through the object of the class.