Hello Friends!!!!! Today I am going to make a program to show the concept of Virtual Function using base class pointers. In this program we make a function iam().Here is Program given Below.....
SO Let's Start=>
//Name : Mayank Sharma//
//Roll No : 1101026//
//CSE(4th Sem)
// WAP to Show the concept of Virtual Function Using Pointer //
#include
#include
class A
{
int a,b;
public:
void getdata()
{
cout<<"enter the value of a and b"<<"\n";
cin>>a>>b;
}
void putdata()
{
cout<<"value of a and b is"< }};
class B : public A
{
int x,y;
public:
void getdata()
{
cout<<"enter the value of x and y"<<"\n";
cin>>x>>y;
}
void putdata()
{
cout<
int main()
{
A a;
B b;
clrscr();
a.getdata();
a.putdata();
b.getdata();
b.putdata();
return 0;
}
I think this post will help you.I think this post will help you.
Thanks!!!
If any query about this post then put your comment in comment box below..






0 comments:
Post a Comment