Thread: static and non-static data members

  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