0% found this document useful (0 votes)
22 views2 pages

EXP21OOP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

EXP21OOP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

include<stdio.h> a ->read();

#include<conio.h> cout<<"Executed by Swarali";

#include<iostream.h> getch();

class parent }

{ public: OUTPUT:

virtual void read()

{ cout<<endl<<"Class Parent:";

cout<<"Base class"<<endl;

};
2.
class child : public parent
#include<iostream.h>
{ public:
#include<conio.h>
void read()
class shape
{
{ public:
cout<<endl<<"Class Child:";
int l,b,a;
cout<<"Derived class";
virtual void area()
}
{
};
a = l * b;
void main()
}
{
};
child p;
class rectangle : public shape
clrscr();
{
parent *c;
public:
child cc;
void area(int l,int b)
c=&cc;
{ a = l * b;

cout<<"Area of rectangle is: "<<a;


c -> read();
}
parent *a;
};
parent b;
void main()
a= &b;
{

rectangle r;

clrscr();

r.area(2,3);

cout<<endl<<"Executed by Swarali";

getch();

OUTPUT:

You might also like