Abstraction
#include <stdafx.h>
#include <iostream>
#include <string>
using namespace std;
class AbstractClass // An abstract class contains atleast one pure virtual function
{
public :
virtual void display()=0; // Pure virtual function is a function declaration equated to 0
};
class ChildClass:public AbstractClass
{
public :
void display()
{
cout<< "display function is defined in child class" << endl;
}
};
int main()
{
cout<< "Example of abstraction" << endl;
ChildClass ch;
ch.display();
return 0;
}
Output:
Example of abstraction
display fuction is defined in child class