Why not?

In my book:

"You cannot initialize the static data member in the class definition — that’s simply a blueprint for an object and initializing values for members are not allowed. You don’t want to initialize it in a constructor, because you want to increment it every time the constructor is called so the count of the number of objects created is accumulated."

Why don't you want to initialize it in a constructor?


Edit: it just hit me lol. Because every time it is called it will set it back to 0 or whatever the initializing value.
Last edited on
why not? because. Thats why.
Your edit is spot on
Topic archived. No new replies allowed.