C++ Program For Overloading vs Overriding
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Program for method overloading and Overriding
#include<iostream>
#define clrscr() system("cls")
using namespace std;
class Base
{
public:
void display()
{
cout<<"\nDispaly of Base without Parameter";
}
};
class Derived:public Base //Method Overriding
{
public:
void display()
{
cout<<"\nDispaly of Derived without Parameter:";
cout<<"hello Hi Bye";
}
void display(int n)
{
cout<<"\nDispaly of Derived with Parameter: "<<n;
}
};
int main()
{
clrscr();
Base B;
// Derived D;
// D.display();
// D.display(100);
}
We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

