Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- struct A
- {
- int x;
- A()
- {
- std::cout << "Default constructor" << std::endl;
- x = 0;
- }
- A(const A& a)
- {
- std::cout << "Copy constructor" << std::endl;
- x = a.x;
- }
- A(const A&& a)
- {
- std::cout << "Move constructor" << std::endl;
- x = a.x;
- }
- };
- A operator+(const A& a1, const A& a2)
- {
- A temp;
- temp.x = a1.x + a2.x;
- return temp;
- }
- int main()
- {
- A a1, a2;
- A s(a1 + a2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment