-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopyCtor.cpp
52 lines (42 loc) · 931 Bytes
/
CopyCtor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* \file CopyCtor.cpp
* \brief Copy constructor
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//------------------------------------------------------------------------------
class A
{
public:
A();
void print() const;
private:
int _i {};
std::string _s;
};
//------------------------------------------------------------------------------
A::A() :
_i{- 1},
_s{"str"}
{
}
//------------------------------------------------------------------------------
void A::print() const
{
std::cout << STD_TRACE_VAR2(_i, _s) << std::endl;
}
//---------------------------------------------------------------------------
int main(int, char **)
{
A a1;
A a2 = a1;
a1.print();
a2.print();
return EXIT_SUCCESS;
}
//---------------------------------------------------------------------------
#if OUTPUT
_i: -1, _s: str
_i: -1, _s: str
#endif