|
-
April 3rd, 2009, 06:14 AM
#7
Re: Stack overflow when declaring array
 Originally Posted by ejohns85
Are they the same?
Effectively, since the second version is likely to be optimised to the first, but if I am not wrong, in theory the second version involves default construction of a temporary and then copy construction of my_class.
 Originally Posted by ejohns85
And is the only difference that if I wanted to have a constructor with parameters, I could use the latter to initialize some variables?
No, you can directly initialise with arguments, e.g.,
Code:
MyClass my_class(x, y, z);
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
|