online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <memory> class Base { public: virtual ~Base() = default; virtual std::unique_ptr<Base> clone() const { std::cout << "Base::cloneRAII()\n"; return std::make_unique<Base>(*this); } virtual void execute() const { std::cout << "Base::process()\n"; } }; class Derived : public Base { public: virtual std::unique_ptr<Base> clone() const override { std::cout << "Derived::clone()\n"; return std::make_unique<Derived>(*this); } virtual void execute() const override { std::cout << "Derived::process()\n"; } }; void process(Base *b) { std::unique_ptr<Base> a = b->clone(); a->execute(); } int main() { Derived d; process(&d); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



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