online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> class Thing { public: // A: constructor taking reference to const integer Thing(const int& val) : m_val(val) { } // B: const function - can't change values of internal variables void printValue() const { std::cout << "Value is " << getValue() << "\n"; } // C: const function returning const reference const int& getValue() const { return m_val; } // D: non-const function taking reference to const object void setValue(const Thing& value) { m_val = value.getValue(); } private: int m_val; }; int main() { Thing thing1(1); const Thing thing2(2); const Thing thing3(3); // Print original thing1.printValue(); thing2.printValue(); thing3.printValue(); // Set items thing1.setValue(thing2); // thing3.setValue(thing2); // Will not compile // Print updated thing1.printValue(); thing2.printValue(); thing3.printValue(); return 0; // 0 = EXIT_SUCCESS }

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