online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <typeinfo> class Base { public: Base() { std::cout << "Base::Base()" << "\n"; this->alloc(); } virtual ~Base() { std::cout << "Base::~Base()" << "\n"; this->dealloc(); } virtual void alloc() { std::cout << "Base::alloc() : " << typeid(this).name() << "\n"; } virtual void dealloc() { std::cout << "Base::dealloc() : " << typeid(this).name() << "\n"; } }; class Derived : public Base { public: Derived() { std::cout << "Derived::Derived()" << "\n"; } virtual ~Derived() { std::cout << "Derived::~Derived()" << "\n"; } virtual void alloc() override { Base::alloc(); std::cout << "Derived::alloc() : " << typeid(this).name() << "\n"; } virtual void dealloc() override { std::cout << "Derived::dealloc() : " << typeid(this).name() << "\n"; Base::dealloc(); } }; int main() { Derived 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.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue