《illustrate c#2008》:

Inheritance allows you to define a new class that incorporates and extends an already declared class.

继承允许你定义一个新的类。这个新的类---包含并且扩展原来已经存在的类。

 

• You can use an existing class, called the base class, as the basis for a new class, called the
derived class. The members of the derived class consist of the following:
– The members in its own declaration
– The members of the base class

 

你能够使用一个已经存在的类,这个已经存在的类叫做基类。这个已经存在的类是新类的基础、基本。这个已经存在的类派生出一个新类,这个派生出来的新类叫做派生类。这个由已经存在的类也叫做基类派生出来的新类也就是派生类,里面的成员由以下组成:

---这个由已经存在的类也叫做基类派生出来的新类也就是派生类中,声明的成员

---这个由已经存在的类也叫做基类,的成员


• To declare a derived class, you add a class-base specification after the class name. The class-base specification consists of a colon, followed by the name of the class to be used as the base class. The derived class is said to directly inherit from the base class listed.

为了声明一个派生类,你加入一个基类的"specification”在类名字的后头。这个基类的"specification”其实一点也不神秘,它由一个“结肠”,并且followed by 类的名字,这个类的名字说穿了就是基类。“结肠”?也就是冒号。
• A derived class is said to extend its base class, because it includes the members of the base class plus any additional functionality provided in its own declaration.

一个派生类被说成是扩展了基类,原因就是派生类include基类的原来的成员,而且还包括额外的函数(这些都有老子我自己定义。)


• A derived class cannot delete any of the members it has inherited.

一个派生类不能删除基类的任何成员。

 

 

 For example, the following shows the declaration of a class called OtherClass, which is derived from a class called SomeClass:

例如:下面就shows了一个新类的声明,这个新类我们命令它的名字叫做"OtherClass",这个"OtherClass"是被派生于一个类,这个类叫做"SomeClass”:

                        Class-base specification
                               ↓
class OtherClass : SomeClass
{                       ↑        ↑
...                    Colon   Base class
}

 这个图可以看出,先前的Class-base specification他妈的就是 “: SomeClass” ,由大肠Colon+基类Base class组成。

 

 

 

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