O quer Dizer essa palavra Privada do Delphi quot;inherite

21/03/2003

0

O quer Dizer essa palavra Privada do Delphi ´[b:4b79b357e6]inherited[/b:4b79b357e6]´ ?


Anonymous

Anonymous

Responder

Posts

21/03/2003

E_gama

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.


Responder

21/03/2003

Marcelo Saviski

[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]


Responder

21/03/2003

Aroldo Zanela

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.


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar