C++ Program using class to overload the function input_data() and display the results using another function display_data( )
/* 3. Write a program using class to overload the function input_data() and
display the results using another function display_data()*/
#include<iostream.h>
#include<conio.h>
class A
{
private:
int a,b;
public:
A()
{
a=b=0;
}
void input_data()
{
cout<<“Enter values for a and b”<<endl;
cin>>a>>b;
}
void display_data()
{
cout<<endl<<“The inputed datas are:\t”<<a<<“\t”<<b<<endl;
}
};
void main()
{
clrscr();
A o1,o2;
o1.input_data();
o1.display_data();
o2.input_data();
o2.display_data();
getch();
}