online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <functional> #include <iostream> using namespace std; class Base { public: template<typename T> void funcA(const T& t){ std::cout<< "In Base with T = " << t << std::endl; } template<typename T> void funcB(const T& t){ funcA(t); } }; class Derived: public Base { public: template<typename T> void funcA(const T& t){ std::cout<< "In Derived with T = " << t << std::endl; } }; int main() { std::cout<<"Direct function override\n"; Base().funcA("ABC"); // Output: In Base with T = ABC Derived().funcA("ABC"); // Output: In Derived with T = ABC std::cout<<"\n\n"; std::cout<<"Indirect function invocation\n"; Base().funcB("ABC"); // Output: In Base with T = ABC Derived().funcB("ABC"); // Output: In Base with T = ABC !!!BAD!!! we don't want this. 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