Accessing the Overridden Methods





This video tutorial explains how to access the overridden base class methods in c++.
You will learn how the base class methods are overridden, how to access the overridden methods in the derived classes and also outside the classes 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;
    Person::introduce();
    }

};

int main()
{
    Student anil;
    anil.introduce();

    return 0;
}

 
Back To Top