freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

面向?qū)ο蟪绦蛟O(shè)計(jì)作業(yè)參考答案-資料下載頁

2025-06-23 03:28本頁面
  

【正文】 eaminclude cmathusing namespace std。class A{public: A(){coutconstrcting A endl。} ~A(){coutdestrcting A endl。}}。class B : public A{public: B(){coutconstrcting B endl。} ~B(){coutdestrcting B endl。}}。class C : public B{public: C(){coutconstrcting C endl。} ~C(){coutdestrcting C endl。}}。int main(){ C c1。 return 0。}輸出結(jié)果如下:constrcting Aconstrcting Bconstrcting Cdestrcting Cdestrcting Bdestrcting A 習(xí)題六寫一個(gè)程序,定義抽象基類Shape,由它派生出3個(gè)派生類,Circle(圓形)、Rectangle(矩形)、Triangle(三角形),用一個(gè)函數(shù)printArea分別輸出以上三只的面積,3個(gè)圖形的數(shù)據(jù)在定義對(duì)象時(shí)給出。代碼如下:include iostreamusing namespace std。///基類Shapeclass Shape{public: void virtual printArea() = 0。//純虛函數(shù)}。//派生類Circleclass Circle : public Shape{public: Circle(double r = 0):radius(r){}//構(gòu)造函數(shù) void printArea(){cout * radius * radiusendl。}private: double radius。//數(shù)據(jù)成員,表示半徑}。//派生類Rectangleclass Rectangle : public Shape{public: Rectangle(double w,double h):width(w),height(h){}//構(gòu)造函數(shù) void printArea(){coutwidth * heightendl。}private: double width。//數(shù)據(jù)成員,表示寬double height。//數(shù)據(jù)成員,表示長}。//派生類Triangleclass Triangle : public Shape{public: Triangle(double w,double h):width(w),height(h){} //構(gòu)造函數(shù) void printArea(){coutwidth * height * endl。}private: double width。//數(shù)據(jù)成員,表示底double height。//數(shù)據(jù)成員,表示高}。//主函數(shù)int main(){ Shape *s。 Circle circle()。 Rectangle rectangle(,)。 Triangle triangle(,)。 s = amp。circle。 sprintArea()。 s = amp。rectangle。 sprintArea()。 s = amp。triangle。 sprintArea()。 return 0。}
點(diǎn)擊復(fù)制文檔內(nèi)容
化學(xué)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1