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) {
19
19
assertEqual (outData + " \r\n " , inData);
20
20
}
21
21
22
+ unittest (Client_copy_constructor) {
23
+ Client client1;
24
+ Client client2;
25
+ client2 = client1;
26
+ assertTrue (true );
27
+ }
28
+
22
29
unittest (IPAddress) {
23
30
IPAddress ipAddress0;
24
31
assertEqual (0 , ipAddress0.asWord ());
Original file line number Diff line number Diff line change @@ -11,6 +11,20 @@ class Client : public Stream {
11
11
mGodmodeDataIn = new String;
12
12
}
13
13
}
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
+ }
14
28
~Client () {
15
29
if (mGodmodeDataIn ) {
16
30
delete mGodmodeDataIn ;
You can’t perform that action at this time.
0 commit comments