L
lovecreatesbeauty
--------- quotation ---------
The default method of initialization using special member functions is
to perform a bit-for-bit copy from the initializer into the object to
be initialized. This technique is applicable only to:
1. Objects of built-in types.
2. Pointers.
3. References.
4. Objects of class type, where the class has no private or protected
members, no virtual functions, and no base classes.
--------- end of quotation ---------
I saw these description when read some documents.
Does the fourth itme says that when perform initialization using copy
ctor or assignment using operator =, the all members of the class can't
be non-public. For example do this:
//Class C1;
C1 o;
C1 o2 = o;
o2 = o;
But even though deriving from a base class, there isn't such a
limitation. Why the limitation can be applied for copying object from a
same class type? Is it true in iso/iec 14882 also?
The default method of initialization using special member functions is
to perform a bit-for-bit copy from the initializer into the object to
be initialized. This technique is applicable only to:
1. Objects of built-in types.
2. Pointers.
3. References.
4. Objects of class type, where the class has no private or protected
members, no virtual functions, and no base classes.
--------- end of quotation ---------
I saw these description when read some documents.
Does the fourth itme says that when perform initialization using copy
ctor or assignment using operator =, the all members of the class can't
be non-public. For example do this:
//Class C1;
C1 o;
C1 o2 = o;
o2 = o;
But even though deriving from a base class, there isn't such a
limitation. Why the limitation can be applied for copying object from a
same class type? Is it true in iso/iec 14882 also?