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

正文內(nèi)容

面向?qū)ο蟪绦蛟O(shè)計資料復(fù)習(xí)2資料-資料下載頁

2025-04-17 12:18本頁面
  

【正文】 class B2: public A { public: B2(){}}。class C: public B1, public B2 //C類由直接基類B 1和B 2公有派生{ public: Derived() {} void Init(int b) { B1::a = b 。 //b賦給基類B1的a成員 } }。83. 下面程序中有一處錯誤,請用下橫線標(biāo)出錯誤所在行并說明出錯原因。class base { public: int x。}。class One:public base{}。class Two:public base{}。class OT:public One,public Two{public: int func()。}。void main() {OT p。::x。}出錯行:::x。出錯原因:基類base不明確,因為One類和Two類都由基類base直接共有派生而來,在One類和Two類中都含有成員變量x六、編程題 84. 假定有一個類,名稱為A,有1個字符型的數(shù)據(jù)成員c和1個整形數(shù)據(jù)成員x。請寫出該類的至少2個不同的構(gòu)造函數(shù)形式。(char newc, int newx):c(newc),x(newx){}//含參()//不含參{ c = ‘\0’。 x = 0。}85. 分別用new和malloc()分配一個有5個元素的整形數(shù)組,名稱為a。int *a = new int[5]。int *a = (int *)malloc(sizeof(int)* 5)。86. 完成一個求圓面積的小程序,要求如下: ①定義一個基類:點類(Dot),包括x坐標(biāo)和y坐標(biāo)(公有或保護(hù)),從它派生一個圓類(Circle),增加私有數(shù)據(jù)成員r(半徑);②圓類的函數(shù)成員包括構(gòu)造函數(shù)、輸入圓心坐標(biāo)及圓半徑的函數(shù)(input)、計算并返回面積的函數(shù)(area);③主函數(shù)中生成一個圓類對象crc,通過構(gòu)造函數(shù)或input函數(shù)為數(shù)據(jù)成員賦值,圓心坐標(biāo)為(6,6),半徑為5。使用對象crc的函數(shù)成員area計算面積,主函數(shù)輸出結(jié)果。includeiostreamusing namespace std。class Dot{protected: int x, y。}。class Cirle:public Dot{public: Cirle(){} void input(int newx, int newy, int newr) { x = newx。 y = newy。 r = newr。 } double area() { return * r * r。 }private: int r。}。void main(){ Cirle crc。 (6, 6, 5)。 cout () endl。}87. 編寫類的定義,完成如下要求: ①定義一個People類,它的數(shù)據(jù)成員有年齡、姓名和性別;(字符串使用字符數(shù)組形式) ②以People類為基類,從中派生出學(xué)生類Student; ③在Student類中,新增一個數(shù)據(jù)成員為高數(shù)成績;④所有數(shù)據(jù)成員的輸入由Student類構(gòu)造函數(shù)實現(xiàn);⑤Student類有一成員函數(shù)為輸出函數(shù),用于輸出所有數(shù)據(jù)成員;⑥主函數(shù)用自己的信息定義一個學(xué)生對象,并輸出該信息。include iostreamusing namespace std。class People{protected: int age。 char sex。 char name[15]。}。class Student : public People{public: Student(int age1, char sex1, char name1[], int mathgrade1) :mathgrade(mathgrade1) { age = age1。 sex = sex1。 strcpy(name, name1)。 } void display() { cout 姓名: name \n年齡: age \n性別: sex \n高數(shù)成績: mathgrade endl。 }private: int mathgrade。}。void main(){ Student stu(18, 39。f39。, wang, 80)。 ()。
點擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1