online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; class A { private: long int a; public: long int b,x; void set_a(){ std::cout<<"Enter variable A's value (integer) \nAnswer: "; std::cin>>a; x=a; } void display_a(){ std::cout<<"\n value for Variable A: "<<x<<std::endl; } void getdata(){ std::cout<<"Enter variable B's value (integer) \nAnswer: "; std::cin>>b; } }; class B:public A { private: long int prod; public: //-------vvvvvvv------------->name changed to product so that it is different from prod data member void product(){ //call these methods here inside product instead of calling them outside on a separater `A` object set_a(); getdata(); display_a(); prod = x*b; } void display(){ std::cout<<"Displaying product of variables A and B \nProduct: "<<prod<<std::endl; } }; int main() { //no need to create a separate `A` object B obj2; obj2.product(); obj2.display(); }

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