You must write a function Get () (Get ()). The number of designers is not equal to the number of destructors.
#include <iostream> class Coord { private: double x, y; public: Coord(double _x = 0, double _y = 0) : x(_x), y(_y) { x = _x; y = _y; std::cout << "Constructor is run" << std::endl; } ~Coord() { std::cout << "Destructor is run" << std::endl; } void Show() { std::cout << "x = " << x << " y = " << y << std::endl; } Coord Get() { return *this; } Coord& operator = (Coord obj) { x = obj.x; y = obj.y; return *this; } }; int main() { Coord object1(10, 15); object1.Show(); Coord object2; object2 = object1.Get(); object2.Show(); return 0; } Tell me, please, what is the error and how to fix it?