Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h" // ezt GNU g++-nal szedd ki!
- #include <iostream>
- class A {
- int _a;
- public:
- A() : _a(55) {}
- A(int const &a) : _a(a) { std::cout << "(1) ctor: " << a << std::endl; }
- A(int const &&a) : _a(a) { std::cout << "(2) ctor: " << a << std::endl; }
- };
- int main()
- {
- int x = 4;
- A a0(x);
- A a1(static_cast<int const&>(x));
- A a2(static_cast<int const&&>(x));
- A a3(static_cast<double const&>(x));
- A a4(reinterpret_cast<int &&>(x));
- A a5(reinterpret_cast<int const &>(x));
- A a6(reinterpret_cast<int const &&>(x));
- A a7(dynamic_cast<A&>(a0));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement