Firstly, thanks for the great site here. Without it i would
have not come this far in becoming familiar and feeling my way
round C++.
I am currently trying to grasp what constructors do in general
from the normal "constructor" to the "copy constructor".
This is where i have found myself at this page :
http://www.cplusplus.com/articles/y8hv0pDG/
Now, i do not want to be picky or anything but my brain is
having a little hard time comprehending this part. Maybe it
can be changed/updated a little..
Quote:
****
Note that none of the following constructors, despite the fact that
they could do the same thing as a copy constructor, are copy
constructors:
1 2
|
MyClass( MyClass* other );
MyClass( const MyClass* other );
| |
****
Hence, excuse the dumb question to ask then but ARE they actually
copy constructors in a round about way?
To try and contribute, i have playing around with constructors,
and found that declaring a constructor like below, that assigns a value
to the integer in the constructor, still builds the object in the main function.
1 2 3 4 5 6 7 8 9 10
|
class World1
{
public:
World1 (int id=9)
...
int main ()
{
//World1 myWorld0(1) ;
World1 myWorld ;
}
| |
Thanks again,
M.