online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <memory> class MyType { int value = 0; //some other things here public: MyType() { std::cout<<"MyType Default constructor"<<std::endl; } }; class Name { std::shared_ptr<MyType> f_ = std::make_shared<MyType>(); //note that you can also write std::shared_ptr<MyType> f_{new MyType}; public: std::shared_ptr<MyType> f() const //f is a const member function returning std::shared_ptr<MyType> { std::cout<<"inside const member function f"<<std::endl; return f_; } }; int main() { const Name n; n.f(); return 0; }

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