3d and 2d shape by using class , inheritance, overloading, overriding, virtual function in c++
#include<iostream> #include<math.h> using namespace std; class shape { protected: double radius,length,width; public: shape() { length=0; width=0; radius=0; } virtual void print() { cout<<"shape"<<endl; } }; class twodimenssional:public shape { protected: double twoarea ; public: twodimenssional() { twoarea=0; } void getdata(); }; class threedimenssional:public shape { protected: double threearea; public: threedimenssional() { threearea=0; } }; class triangle:public twodimenssional { public: void calculatearea() { twoarea=length*width/2; } void print() { cout<<"area of triangle is : "<<twoarea<<endl; } void setdata(double a,double b) { width=a; length=b; } void getdata() { cout<<"enter width : "; cin>>width; cou...