请根据以下给出的程序,将代码补充完整。(请直接作答,不要提交附件) class CBShape { protected: double base; double height; public: //请在(1) 处声明并实现CBShape构造函数 ( 1 ) //请在(2) 处声明并实现CBShape的接口函数 GetArea() ( 2 ) }; class CTria:public CBShape{ public: CTria(double b,double h):CBShape(b,h) { } double GetArea() { return base*height*0.5; } }; class CRectangle:public CBShape{ public: CRectangle(double w,double h):CBShape(w,h) { } double GetArea() { return width*height; } }; //请在(3)处给出CaculateArea函数的定义和实现,此函数完成面积的计算 ( 3) void main(){ CTria A(4,2); CRectangle B(4,2); cout<<"底边为4,高为2的三角形面积等于"<<caculatearea(&a)<<endl; } (1) (2)>
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!