static and non-static data members

This is a discussion on static and non-static data members within the C++ Programming forums, part of the General Programming Boards category; Just a qucik question. What is the difference between static and non-static data members of a class?...

  1. #1
    Unregistered
    Guest

    Question static and non-static data members

    Just a qucik question. What is the difference between static and non-static data members of a class?

  2. #2
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301
    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.

  3. #3
    Unregistered
    Guest

    Talking

    Thanks for the explaination! It helps a lot.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21