O quer Dizer essa palavra Privada do Delphi quot;inherite
O quer Dizer essa palavra Privada do Delphi ´[b:4b79b357e6]inherited[/b:4b79b357e6]´ ?
Anonymous
Curtidas 0
Respostas
E_gama
21/03/2003
Quando vc cria um componente, e precisa colocar algum código no ´OnCreate´ dele por exemplo, vc escreve seu código, mas depois, ao final, vc chama essa função ´Inherited´, que executa o ´OnCreate´ original do componente que vc utilizou como base.
GOSTEI 0
Marcelo Saviski
21/03/2003
[color=#012345:1b2323b6ed]Ela passa um comando para sua classe mãe
EX:
Você ten uma classe que herda de uma outra classe qualquer, andes de criala é nessessário que as classes antecessoras sejam ciadas:[/color:1b2323b6ed]
[b:1b2323b6ed]constructor[/b:1b2323b6ed] create(AOWer : TObject);
[b:1b2323b6ed]begin
inherited [/b:1b2323b6ed]Create(AOwer);
...
[b:1b2323b6ed]end;[/b:1b2323b6ed]
EX:
Você ten uma classe que herda de uma outra classe qualquer, andes de criala é nessessário que as classes antecessoras sejam ciadas:[/color:1b2323b6ed]
[b:1b2323b6ed]constructor[/b:1b2323b6ed] create(AOWer : TObject);
[b:1b2323b6ed]begin
inherited [/b:1b2323b6ed]Create(AOwer);
...
[b:1b2323b6ed]end;[/b:1b2323b6ed]
GOSTEI 0
Aroldo Zanela
21/03/2003
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 the name of a member, it represents a normal method call or reference to a property or field--except that the search for the referenced member begins with the immediate ancestor of the enclosing method´s 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 or, if the enclosing method is a message handler, to the inherited message handler for the same message. In this case, inherited takes no explicit parameters, but 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.
If inherited is followed by the name of a member, it represents a normal method call or reference to a property or field--except that the search for the referenced member begins with the immediate ancestor of the enclosing method´s 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 or, if the enclosing method is a message handler, to the inherited message handler for the same message. In this case, inherited takes no explicit parameters, but 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.
GOSTEI 0