online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <functional> template<typename T> using FnctPtr = void(T::*)(); // pointer to member function returning void class Base { public: Base() : vtable_ptr{ &virtual_table[0] } {} void foo() { std::cout << "Base"; } void x() { std::cout << "X"; } private: // array of pointer to member function returning void inline static FnctPtr<Base> virtual_table[2] = { &Base::foo, &Base::x }; public: FnctPtr<Base>* vtable_ptr; }; int main() { Base* base = new Base(); (base->*(base->vtable_ptr[0]))(); //(base->vtable_ptr)[0](); // Issue here delete base; }

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