online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> class IFoo { public: virtual int GetSum() = 0; }; class Foo2 : public IFoo { public: Foo2(int x, int y) : x_(x), y_(y) { printf("Creating Foo2 with: x=%u, y=%u\n", x, y); } int GetSum() override { return x_ + y_; } int x_; int y_; }; class Bar { public: Bar(Foo2 foo) : foo_(foo) { } IFoo& foo_; }; class Foo { public: Foo(int x, int y) : bar_(Foo2(x, y)) { } Bar bar_; }; int main() { Foo foo(1, 2); Bar bar(Foo2(2, 3)); printf("The sum of foo is: %u (expected 3)\n", foo.bar_.foo_.GetSum()); printf("The sum of bar is: %u (expected 5)\n", bar.foo_.GetSum()); 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