Overriding the Base Class Methods in Derived Class
This video tutorial explains how to override the base class methods in the derived class in c++.
You will learn what happens when the base class and the derived class have the same methods with same signature in detail with example.
source code for this tutorial
#include <iostream>
using namespace std;
class Person{
public:
void introduce(){
cout << "hi i am a person"<<endl;
}
};
class Student : public Person{
public:
void introduce(){
cout << "hi i am a student and i am awesome"<<endl;
}
};
int main()
{
Student anil;
anil.introduce();
return 0;
}