Example & Tutorial understanding programming in easy ways.

What is the function overriding in C++

What is function overriding in C++:
If derived class defines same function as defined in its base class, it is known as function overriding in C++.
-It is the example of run time polymorphism:

program:

#include< iostream>
using namespace std;
class parent {
public:
void func(){
cout<<"This is my parent function";
}
};
class child: public parent
{
public:
void func()
{
cout<<"Child function";
}
};
int main(void) {
child d = child();
d.func();
return 0;
}


output-

Child function




Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!