- 1、本文档共20页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C 08《多态性》(国外英文资料)
C 08《多态性》(国外英文资料)
C++08 polymorphism,.Txt
VC++ eighth class 2004.3.31 polymorphism
I. overview of polymorphism
Polymorphism: a name, multiple functions.
Polymorphic types: compile time polymorphism and runtime polymorphism.
Static binding: depending on the arguments used, the compiler can determine which function to call. Mainly refers to the realization of overloading function linkage, can also include class templates, implicit type conversion implementation of the couplet.
Dynamic linking: when a program runs, it calls the member function of the object according to the actual object it refers to.
Chrysene - - grosseserrata chrysene grosseserrata
Of static binding and dynamic binding,,,
-- --
Scott
Produced, respectively.
Here
Chrysene ---- grosseserrata chrysene ---- grosseserrata
Polymorphism, polymorphism, and, when run, compile
---- ----
Advantages: speed, advantages: flexibility
Disadvantages: lack of flexibility: bad execution
Implementation: implemented with overloaded functions: through inheritance and virtual functions
Two, the basic properties of virtual functions
General virtual function members writing: add the virtual before the function prototype of the base class, and do not add it when implemented
Such as:
Class A {
Public:
Virtual void (f); / / virtual function
};
Must be public derived;
The virtual property can be passed along a derived relationship and cannot be uploaded; the base classs function is virtual, and the same name function (and the same parameter, the same return type) of the subclass is also virtual.
Access authority:
(1) dynamic calling is invoked when a virtual function is called through a pointer of a base class type
(2) dynamic invocation is also called when a virtual function is called through a reference to a base class type
(3) call a virtual function through an object, then use a static join
(4)
----------------------------------------------------------------------------------
Legend 1: a class of directed acyclic graphs (DA
您可能关注的文档
- (一)民法总论案例分析(国外英文资料).doc
- (推荐)大学生应聘面试技巧(国外英文资料).doc
- (流言终结者)已检讨过的流言(部分)(国外英文资料).doc
- (免费!)物理电功率总复习(精心整理)(国外英文资料).doc
- (2013年)企业招聘、岗位分析、任职资格(国外英文资料).doc
- (人教版)高一物理必修2第五章曲线运动测试题(国外英文资料).doc
- (电大毕业论文范文)本科生毕业论文范文浅谈化工设备设计计算理由(国外英文资料).doc
- (锅检所)压力管道安装所需准备资料(国外英文资料).doc
- (新版)涤纶长丝涤纶纤维涤纶生产配方制备工艺专利技术文集(国外英文资料).doc
- .bash_profile文件的作用(国外英文资料).doc
最近下载
- 《我爱我的家乡》音乐教案.docx VIP
- 化工企业(化工厂)全套安全生产操作规程.doc VIP
- 湖北2024年上学期九年级G20(12月)联考数学试卷含答案.pdf
- 土木工程施工(第4版)毛鹤琴习题答案详解.pdf
- 烟雨繁华或故都血色:南京的记忆与书写——前言.pdf VIP
- (粤教版)科学三年级上册期末质量测试题(3套)有答案.doc VIP
- 2022~2023计算机四级考试题库及答案参考34 .pdf
- 华南师范大学2021-2022学年第1学期《教育心理学》期末考试试卷及标准答案.docx
- 2023年资产评估师房地产估价案例与分析改错题.pdf VIP
- 2020年国家开放大学《中国古代文学B(2)》形考任务(1-4)试题及答案解析.pdf VIP
文档评论(0)