Created
June 12, 2014 09:53
-
-
Save skomik/d9b9f3a677057b6c73b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class MemberClass{ | |
public: | |
MemberClass() { std::cout << "MemberClass: default constructor\n"; } | |
MemberClass(const MemberClass&) { std::cout << "MemberClass: copy constructor\n"; } | |
MemberClass(MemberClass&&) { std::cout << "MemberClass: move constructor\n"; } | |
MemberClass& operator=(const MemberClass&) { std::cout << "MemberClass: copy assignment\n"; return *this; } | |
MemberClass& operator=(MemberClass&&) { std::cout << "MemberClass: move assignment\n"; return *this; } | |
}; | |
class Base { | |
public: | |
virtual ~Base() {} | |
private: | |
MemberClass member; | |
}; | |
class Derived : public Base { | |
private: | |
MemberClass member; | |
}; | |
int main() | |
{ | |
Derived d1; | |
Derived d2 = std::move(d1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment