全文预览

java的面向对象编程外文资料翻译(适用于毕业论文外文翻译+中英文对照)

上传者:梦溪 |  格式:doc  |  页数:12 |  大小:0KB

文档介绍
s might be quite different from one another, we can create an array of references to them — as long as we treat them as superclass objects. But the reverse isnot true: A superclass object cannot always be treated a subclass object. For example, a Shape isnot always a Circle. Despite the fact that a subclass object also “ isa” superclass object, the subclass type and the superclass type are different. Subclass objects can be treated as superclass objects. This makes sense because the subclass has members corresponding to each of the superclass members — remember that the subclass normally has more members than the superclass has. Assignment in the other direction isnot allowed because assigning a superclass object toa subclass reference would leave the additional subclass members undefined.

收藏

分享

举报
下载此文档