|
-
November 16th, 2010, 11:40 AM
#10
Re: Why can't member variable be initialized?
 Originally Posted by laserlight
Not quite: this is initialisation, but assigning in the body of the constructor is assignment. This is an important difference when the member variable is const or of a reference type, and also if the member variable is of a class type whose default constructor does something significant (or which does not have a default constructor). In Lindley's example, it is merely of a built-in type, so there is pretty much no net difference.
Thank you! There is sill a lot for me to learn. So bottom line if the member variable is just simple int or double type then either way is fine, right?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|