hello and thank you kooth! :)
let me try to understand and regive it:
|
CDummy & operator = ( const CDummy& C );
|
The
copy assignment operator is a function of type overloaded operator "=" with a constant CDummy& parameter "C" (where CDummy& is the address of the argument "C").
This Function returns a value of Type CDummy& (where CDummy & is the address of the value returned by the function).
How does a
copy constructor looks like then?
according to the tutorial here, it's the following:
1 2 3
|
CExample::CExample (const CExample& rv) {
a=rv.a; b=rv.b; c=rv.c;
}
|
so declared in class as a prototype should it be like this then?:
1 2 3 4 5 6
|
class CExample{
CExample& CExample (const CExample&);
.
.
.
}
|
So basically
copy constructor and
copy assignment operator do the same ? Or is there a difference?
and last but not least
Is there a difference between
CDummy& C,
CDummy & C and
CDummy &C ?
as far as i've read, spaces are irrelevant for c++ ôo .
//edit: sry, but after loosing the text 3 times, because i got logged out while writing, i might wrote it a bit diffcult to understand :/
if something is unclear, ask me :>
anyway, thank you in advance!
kind regards
genbatzu~