《illustrate c# 2008》:

All Classes Are Derived from Class object
所有的类来自于类object

All classes, except special class object, are derived classes, even if they don’t have a class-base specification. Class object is the only one that is not derived, since it is the base of the inheritance hierarchy.

 

所有的类,除了类object,都是派生类,即使后面没有 ":SomeClass”之类的"class-base specification".类object,是唯一一个类,这个唯一体现在他不是被派生的,他就是他,因为他是所有继承层次结构的基础。
Classes without a class-base specification are implicitly derived directly from class object.Leaving off the class-base specification is just shorthand for specifying that object is the base class. The two forms are semantically equivalent. Figure 7-2 shows both forms of declaration for the same class.

 一个类后面没有 ":SomeClass”之类的"class-base specification",这个类也是继承类,为什么,因为他implicitly继承于类object。离开了"class-base specification"也就是没有"class-base specification"的类,仅仅是以object类为基类的"shorthand"(简写),下面就来说明这个问题,图7-2显示了2个等价的类声明:

 

posted on 2010-08-22 01:51  菜刀大侠  阅读(371)  评论(0编辑  收藏  举报