Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // testrvalue.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- class b
- {
- public:
- b()
- {
- std::cout << "b::b" << std::endl;
- }
- ~b()
- {
- std::cout << "b::~b" << std::endl;
- }
- b(b&&)
- {
- std::cout << "b && o" << std::endl;
- }
- b(const b&)
- {
- std::cout << "const b&" << std::endl;
- }
- void done()
- {
- std::cout << "done" << std::endl;
- }
- };
- class a
- {
- b b_;
- public:
- a()
- {
- std::cout << "a::a" << std::endl;
- }
- ~a()
- {
- std::cout << "a::~a" << std::endl;
- }
- a(a&&)
- {
- std::cout << "a&&" << std::endl;
- }
- a(const a&)
- {
- std::cout << "const a&" << std::endl;
- }
- void done()
- {
- b_.done();
- }
- };
- a construct()
- {
- return a();
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- auto t = construct();
- t.done();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement