Just a qucik question. What is the difference between static and non-static data members of a class?
Printable View
Just a qucik question. What is the difference between static and non-static data members of a class?
a static member of a class has its value shared between all instances of a class.
example: if you want to have all your objects of your "car" class have a unique serial number that increments every time a new car object is created you'd use a static int that would be incremented in the constructor.
Thanks for the explaination! It helps a lot.