online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <string> class Point { private: int x, y; public: // Normal constructor. Point(int x1, int y1) { x = x1; y = y1; std::cout << ">> Normal constructor called.\n"; } // Copy constructor. Point(const Point& p2) { x = p2.x; y = p2.y; std::cout << ">> Copy constructor called.\n"; } std::string Print() const { return "(" + std::to_string(x) + ", " + std::to_string(y) + ")"; } }; Point GetPoint() { Point p(1, 2); return p; } Point GetConstPoint2() { static Point* p = new Point(1, 2); return *p; } const Point* GetConstPoint3() { static Point* p = new Point(1, 2); return p; } int main() { Point p = GetPoint(); std::cout << ">> " << p.Print() << std::endl; Point p2 = GetConstPoint2(); std::cout << ">> " << p2.Print() << std::endl; const Point* p3 = GetConstPoint3(); std::cout << ">> " << p3->Print() << std::endl; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue