Archived

This topic is now archived and is closed to further replies.

VC7 and const class members

This topic is 5431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

does VC7 handle const class members correctly? VC6 doesn''t, i''m pretty sure you are supposed to be able to do something like this:
class MyClass
{
   const int SomeConst = 5; // doesn''t work in vc6, but i''m almost positive you are supposed to be able to
};
 
if you are supposed to be able to, does VC7 do it right?

Share this post


Link to post
Share on other sites
Sure does.

Edit: But only when they are static const

If I had my way, I'd have all of you shot!


codeka.com - Just click it.

[edited by - Dean Harding on March 6, 2003 5:56:33 AM]

Share this post


Link to post
Share on other sites
Considering const members are instance-specific, they need to be initialized in the constructor.

Share this post


Link to post
Share on other sites
quote:
Original post by daerid
Considering const members are instance-specific, they need to be initialized in the constructor.

Except, as has been said, when they are static


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites