Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: default Enu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 8 Topic 45816 of 47034
Post > Topic >>

Re: default Enum values?

by brno <brno.barutchek@[EMAIL PROTECTED] > May 10, 2008 at 10:39 AM

Ian Collins dixit:
> Travis wrote:
>> 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? 
> 
> Unless you initialise it, the value is undefined.
> 
Static ("global") variable are default initialize (int for example is 0) 
Is it undefined even if it is part of a global object ? For example in:

main.cc:
--------

class A {
     Days d;
};

A globalA;

int main() {}
 




 8 Posts in Topic:
default Enum values?
Travis <travis.bowers@  2008-05-08 15:37:37 
Re: default Enum values?
Ian Collins <ian-news@  2008-05-09 11:12:25 
Re: default Enum values?
brno <brno.barutchek@[  2008-05-10 10:39:30 
Re: default Enum values?
Ian Collins <ian-news@  2008-05-10 20:52:50 
Re: default Enum values?
Travis <travis.bowers@  2008-05-08 16:44:32 
Re: default Enum values?
Ian Collins <ian-news@  2008-05-09 11:58:27 
Re: default Enum values?
Travis <travis.bowers@  2008-05-08 16:53:47 
Re: default Enum values?
Greg Herlihy <greghe@[  2008-05-10 03:00:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:08:26 CDT 2008.