initialized to some default value if you don't initialize it yourself in the constructor? Is that default value always 1?
Why would you think the default value would be 1?
It depends on how you're creating the object. If it's on stack a constructor will be called which sets the values based on what you've done in the constructor.
Do not assume that data members will be initialized in all cases. An object created with malloc for instance will not call your constructor, it will be uninitialized.
Обсуждают сегодня