When you declare a class, you can
specify its immediate ancestor. For example,
type
TSomeControl = class(TControl);
declares a class called TSomeControl
that descends from TControl. A class type automatically inherits all of
the members from its immediate ancestor. Each class can declare new members and
can redefine inherited ones, but a class cannot remove members defined in an
ancestor. Hence TSomeControl contains all of the members defined in TControl
and in each of TControl's ancestors.
The scope of a member’s identifier
starts at the point where the member is declared, continues to the end of the
class declaration, and extends over all descendants of the class and the blocks
of all methods defined in the class and its descendants.
声明类时可以指定其直接祖先。例如,
type
TSomeControl = class(TControl);
这里声明了一个叫做TSomeControl的类,它遗传自TControl。类类型自动继承其直接祖先的所有成员。每个类可以声明新的成员,也可以重定义继承到的成员,但一个类不能删除在其祖先中定义的成员。因此TSomeControl包含了在TControl及其每个祖先中定义的所有成员。
类成员标识符的作用域开始于其被声明的点,一直到类声明结束,并且延伸到其所有的后裔、在类及其后裔类中定义的所有方法的块。