Earlier versions of C++ (prior to release 1.2) implemented assignment between objects through bit-wise copy of the source to the destination. Consider the following example that illustrates a bit-wise copy.
C++
xxxxxxxxxx
1
11
1
class MyString { 2
public: 3
4
MyString(int n) { size = n; rep = new char[size]; } 5
~MyString() { delete [] rep; } 6
int length() const { return size; } 7
8
private: 9
char* rep; 10
int size; 11
}; /* MyString */
The main program has two objects of class MyString.
from DZone.com Feed https://ift.tt/2x0NeMa
No comments:
Post a Comment