Pure Virtual Functions and Abstract Classes





This video tutorial explains about the pure virtual functions and the abstract classes in c++.
You are gonna learn what is a pure virtual function, how to define a pure virtual function, how to define pure virtual function in base class and derived class, what are abstract classes in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;

class Person{
public:
   virtual void introduce()=0;

};

void Person :: introduce(){
cout << "hey from person"<<endl;
}

class Student : public Person{
public:
   void introduce(){
    cout << "hi i am a student"<<endl;
    Person ::introduce();
    }
};

int main()
{
Student anil;
anil.introduce();
    return 0;
}

 
Back To Top