File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
SampleProjects/TestSomething/test Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ unittest(Client) {
1919 assertEqual (outData + " \r\n " , inData);
2020}
2121
22+ unittest (Client_copy_constructor) {
23+ Client client1;
24+ Client client2;
25+ client2 = client1;
26+ assertTrue (true );
27+ }
28+
2229unittest (IPAddress) {
2330 IPAddress ipAddress0;
2431 assertEqual (0 , ipAddress0.asWord ());
Original file line number Diff line number Diff line change @@ -11,6 +11,20 @@ class Client : public Stream {
1111 mGodmodeDataIn = new String;
1212 }
1313 }
14+ Client (const Client &client) {
15+ // copy constructor
16+ if (mGodmodeDataIn ) {
17+ mGodmodeDataIn = new String (mGodmodeDataIn ->c_str ());
18+ }
19+ std::cout << __FILE__ << " :" << __LINE__ << std::endl;
20+ }
21+ Client & operator =(const Client &client) {
22+ // copy assignment operator
23+ if (mGodmodeDataIn ) {
24+ mGodmodeDataIn = new String (mGodmodeDataIn ->c_str ());
25+ }
26+ return *this ;
27+ }
1428 ~Client () {
1529 if (mGodmodeDataIn ) {
1630 delete mGodmodeDataIn ;
You can’t perform that action at this time.
0 commit comments