文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C#笔记~胡说胡记系列0.0.0.4

C#笔记~胡说胡记系列0.0.0.4

时间:2010-08-22  来源:菜刀大侠

Other important facts about class derivation are the following:

关于继承类的其他要点如下:
• A class declaration can have only a single class listed in its class-base specification. This is called single inheritance.

一个类的声明中只能拥有一个single类listed in its class-base specification。这就叫做单继承。
• Although a class can directly inherit from only a single base class, there is no limit to the
level of derivation. That is, the class listed as the base class might be derived from
another class, which is derived from another class, and so forth, until you eventually
reach object.

虽然只能直接继承于一个基类,但是there is no limit,no limit 什么呢?也就是继承的level没有限制。作为基类的类也可以继承于其它类,而被基类继承的类又可以继承于另一个其他类,一直递归到object为止。
Base class and derived class are relative terms. All classes are derived classes, either from object or from another class—so generally when we call a class a derived class, we mean that it is immediately derived from some class other than object. Figure 7-3 shows a simple class hierarchy. After this, I will not show object in the figures, since all classes are ultimately derived from it.

基类和派生类只是一个相对的说法。所有类都是派生类。要么继承于object要么继承于其它类----所以一般当我们叫一个类为派生类的时候,我们的意思是:这个类直接继承于某个类,他不是直接继承于类object,因为根据定义直接继承于类object的类就可以省略":SomeClass”(class-base specification),而你现在这个类没有省略":SomeClass”(class-base specification),从逻辑上推出你就是个继承类(虽然继承只是个相对术语,因为所有的类都是继承类)。

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载