

下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、象程序設計試題(C 卷 用題班級2使用const 定義常量與用使用define 中標,錯誤的標象程序設計試題(C 卷 用題班級2使用const 定義常量與用使用define 中標,錯誤的標C+只支持象程序設計派生類的成員函數(shù)可以直基類3操作符delete的作用是什么?如何刪除單個用new 申請的空間?如何刪除申請的delete 刪除一個類的對象時,會發(fā)生哪些操作?必要時,請用代碼說用class當一個對象被銷毀時,以與構造函數(shù)調用順序相反的順序調用析構函問答題(5 40 分一二三四五六8public、protected、private private 成員被繼承到子類后,其8public、pro
2、tected、private private 成員被繼承到子類后,其自動局部對象(Automaticlocalobjects)的構造函數(shù)、析構函數(shù)分別是什么時候被調用, 1A classs data members (variables he class and functions (functions declared in the class definition) belong tot classs scope. Nonmember functions are defined at file scope.Within a classs scope, class members are y
3、 y all t member functions and can be referenced by name. Outside a classs scope, public class members are referenced through one of the handles on an objectan object name, reference toanobjectora er to an object.The type of the object, reference or specifieserface(i.e.,themember functions)sibleto th
4、e (注:在不影響理解前題下,下列程序均略去了必要的頭文件、名稱空間classBCsayHi()coutJusthi.調用BC類的sayHiendl; void run() cout in Base:run endl; classDC1:public 2In(注:在不影響理解前題下,下列程序均略去了必要的頭文件、名稱空間classBCsayHi()coutJusthi.調用BC類的sayHiendl; void run() cout in Base:run endl; classDC1:public 2In Section 13.3.1, we assigned the address of
5、a derived-class object to a base-voidrun()coutinker:runendl;er and t the C+ compiler allows this assignment, because classDC2:publicvoidsayHicout在Tailor中endlderived-class object is a base-class object. We take the ite approach in Fig. 13.6, abase-aEmployee member function, including setBaseSalary, f
6、or the to which the po the Commisos (i.e., the base-class object Employee). voidrun()coutailor:runendl;Employee object does not provide a setBaseSalary member function, does it provide a baseSalary data member to set. This could lead to problems, main()BC*member function setBaseSalary would t there
7、is a baseSalary data member its usual location in Employee object. This memory forwhich=1;which not belong to the Commis overwriteotherimportantdataEmployee, object so member function setBaseSalary which+) switch( which ) case 1: p = new BC; break; case2:p=newDC1;break; case 3:p= newDC2;deletesiblyhat belongstoadifferent returninreturnclassclassb; returnclassclassb; 1(8分)采用面、main() BInitualizingAA! InitualizingBB! Ending main!DestroyingBB! Destroying voidre
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年海水淡化及水處理設備項目發(fā)展計劃
- 教育技術創(chuàng)新塑造未來的學習體驗
- 教育政策與教師能力提升的相互促進關系
- 未來十年的教育創(chuàng)新趨勢與挑戰(zhàn)
- 企業(yè)如何通過智能倉儲提升競爭力
- 教育心理學視角下的學生成效評估體系構建
- 基礎護士重癥科生命支持技術考試題庫及答案
- 醫(yī)療輔助教育探索新型教育模式
- 中職政治教學課件
- 在線考試系統(tǒng)的未來發(fā)展及挑戰(zhàn)分析
- 國家開放大學漢語言文學本科《古代詩歌散文專題》期末紙質考試第一大題選擇題庫2025春期版
- 工程造價司法鑒定實施方案
- 煤礦崗位作業(yè)流程培訓
- 2024年紹興市鏡湖開發(fā)集團有限公司下屬國企招聘筆試真題
- 眼科院感培訓
- 混凝土工培訓
- “三新”背景下高中語文大單元教學的策略研究
- 2025年中國體外培育牛黃行業(yè)發(fā)展監(jiān)測及投資戰(zhàn)略咨詢報告
- 設備廠房租賃合同
- 復烤廠安全生產管理培訓
- 華師大版七年級上冊初一數(shù)學(基礎版)(全冊知識點考點梳理、重點題型分類鞏固練習)(家教、補習、復習用)
評論
0/150
提交評論