T
Travis
I'm curious, if you have an enum say...
enum Days { Mon, Tue, Wed, Thu, Fri, Sat, Sun };
I understand the default will be Mon=0, Tue=1, Wed=2, etc.
What I'm curious about is if there is a Days attribute in a class,
what is the default assuming I don't do anything with it?
For example
class Foo
{
public:
Days week;
};
If I instantiate a Foo object, what is the default of week? Is there
any possibility (perhaps compiler dependent) that if I created and
destroyed Foo objects at an interval of less than 1 second, could
value of week change?
So for talking purposes say I have...
int main()
{
for (int i = 0; i < 10000; ++i) {
Foo *f = new Foo;
cout << f->week << endl;
delete f;
}
Will I get 10000 lines of 0?
enum Days { Mon, Tue, Wed, Thu, Fri, Sat, Sun };
I understand the default will be Mon=0, Tue=1, Wed=2, etc.
What I'm curious about is if there is a Days attribute in a class,
what is the default assuming I don't do anything with it?
For example
class Foo
{
public:
Days week;
};
If I instantiate a Foo object, what is the default of week? Is there
any possibility (perhaps compiler dependent) that if I created and
destroyed Foo objects at an interval of less than 1 second, could
value of week change?
So for talking purposes say I have...
int main()
{
for (int i = 0; i < 10000; ++i) {
Foo *f = new Foo;
cout << f->week << endl;
delete f;
}
Will I get 10000 lines of 0?