#include #include #include #include using namespace std; class Upp { public: Upp() : l{nullptr}, r{nullptr} {} Upp(int l, int r) : l{new int{l}}, r{new int{r}} {} ~Upp() { delete l; delete r; } Upp(Upp const& other) = delete; Upp operator=(Upp const& other) = delete; Upp(Upp && other) : Upp{} { *this = move(other); } Upp& operator=(Upp && other) { swap(l, other.l); swap(r, other.r); return *this; } int right() const { return *r; } int left() const { return *l; } private: int* l; int* r; }; int main() { Upp upp1{1, 2}; cout << upp1.right() << ", " << upp1.left() << endl; }