首页 | 本学科首页   官方微博 | 高级检索  
     

浅析C + +和Java的继承机制
引用本文:姜慧霖 乔丽. 浅析C + +和Java的继承机制[J]. 开封大学学报, 2005, 19(3): 85-87
作者姓名:姜慧霖 乔丽
作者单位:商丘师范学院计算机科学系,河南商丘476000
摘    要:C + +支持类的多继承,Java采用类的单继承.Java中引入了接口,它定义了一组协议规范,即方法原型,将方法的实现部分放到类中完成,从而将接口继承与实现继承分开.接口继承可以间接替代多继承,具有多继承的优点,而且使用简单.

关 键 词:继承 多继承 接口 实现
文章编号:1008-343X(2005)03-0085-03
收稿时间:2005-03-14
修稿时间:2005-03-14

The analysis to the Inheritance Mechanism in C + + and Java
JIANG Hui - lin, QIAO Li. The analysis to the Inheritance Mechanism in C + + and Java[J]. Journal of Kaifeng University, 2005, 19(3): 85-87
Authors:JIANG Hui - lin   QIAO Li
Abstract:C++ uses multiple inheritance,while Java discards multiple inheritance of class.However Java introduces interface which are protocol specifications which define prototypes of methods without implementations.The implementing parts are deferred until a class implements the interface.The separation of interface and implementation results in the independent interface inheritance.Hence,the inheritance provided by interface is much simpler and more flexible than multiple inheritance of class.
Keywords:Inheritance    Multiple inheritance   Interface   Implementation
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号