谁能告诉我inherited有什么作用啊?(20分)

  • 主题发起人 主题发起人 yinnifeiyang
  • 开始时间 开始时间
Y

yinnifeiyang

Unregistered / Unconfirmed
GUEST, unregistred user!
我看到有些程序当中有inherited这个语句,知道是继承的意思,可我没有用过,也不知道
有什么作用,谁能告诉我呢??
 
The reserved word inherited plays a special role in implementing polymorphic
behavior. It can occur in method definitions, with or without an identifier
after it.
If inherited is followed by a method identifier, it represents a normal method
call, except that the search for the method begin
s with the immediate ancestor
of the enclosing method抯 class. For example, when
inherited Create(...);
occurs in the definition of a method, it calls the inherited Create.
When inherited has no identifier after it, it refers to the inherited method
with the same name as the enclosing method. In this case, inherited can appear
with or without parameters;
if no parameters are specified, it passes to the
inherited method the same parameters with which the enclosing method was
called. For example,
inherited;
occurs frequently in the implementation of constructors. It calls the inherited
constructor with the same parameters that were passed to the descendant.
 
在派生类的对方法的重载中调用父类同名方法
 
先看看oop吧,老兄
 
简单的说就是继承写在父类中的方法代码.
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
835
SUNSTONE的Delphi笔记
S
S
回复
0
查看
765
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部