#include #include class shape {protected:double d1,d2; public:virtual void displayarea()=0; void getdata() {cout<<"\n enter the parameters for area to be calculated:"; cout<<"\n enter length: "; cin>>d1; cout<<"\n enter width or height: "; cin>>d2; } }; class triangle:public shape {public:void displayarea() {cout<<"\n the area of triangle is:"<>i; switch(i) {case 1:cout<<"\nfor rectangle\n"; ptr=&r; ptr->getdata(); ptr->displayarea(); break; case 2:cout<<"\nfor triangle\n"; ptr=&t; ptr->getdata(); ptr->displayarea(); break; case 3:n=1; break; default:cout<<"\n sorry you have entered wrong choice\n"; } cout<<"\n do you want to continue (yes:0,no:1):"; cin>>n; } getch(); }