Example:
#include<iostream.h>
#include<conio.h>
Class A
{
int
a,b;
public:
A
(int s, int t) //Parameterized
Constructor
{
a=s;
b=t;
}
void
put();
};
void A :: put()
{
cout<<a<<b;
}
Class B : Public A
{
int
c;
B
(int s, int t, int m): A (s,t)
{
c=m;
}
void
putdata();
};
void B :: putdata()
{
cout<<c;
}
Void main ()
{
clrscr();
B
ba(3,8,9);
ba.put();
ba.putdata();
getch();
}
No comments:
Post a Comment