C++和Java继承机制的比较  被引量:1

Comparis on of the Inheritance Mechanism in C++ and Java

在线阅读下载全文

作  者:李慧琪[1] 李玉茜[1] 

机构地区:[1]华东师范大学计算机系,上海200062

出  处:《计算机工程》1997年第S1期238-241,共4页Computer Engineering

摘  要:C++支持类的多继承,而Java采用类的单继承。类的多继承有其灵活性,但语义复杂给使用带来了困难。Java中引入了接口,接口中定义了一组协议规范,即方法原型。将方法的实现部分推迟到类中完成,从而将接口继承与实现继承分开。接口继承可以间接替代多继承,具有多继承的优点,而且使用简单。C++ uses multiple inheritance, while Java discards multiple inheritance of class. However, Java introduces interface, which solves many of the problems for which multiple inheritance has been found to be useful. Interfaces are protocol specifications which define prototypes of methods without implementations. The implementing parts are deferred until a class implements the interface. The seperation 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.

关 键 词:继承 多继承 接口 实现 

分 类 号:TP312[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象