Difference between revisions of "As/es"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "== As == La palabra reservada '''As''' pertenece a la programación orientada a objetos y se utiliza para convertir (TypeCast) un objeto en una clase. Para ello, el objeto de...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
{{as}}
 
== As ==
 
== As ==
  
Line 6: Line 7:
 
Ejemplo:
 
Ejemplo:
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
 
procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
 
begin
 
begin
Line 14: Line 15:
  
 
Aquí  la variable Sender del tipo (type of) TObject se convierte/asigna como ('''as''') tipo (type) TDBGrid.
 
Aquí  la variable Sender del tipo (type of) TObject se convierte/asigna como ('''as''') tipo (type) TDBGrid.
 
[[Category:Reserved words/es]]
 

Latest revision as of 02:26, 31 January 2020

Deutsch (de) English (en) español (es) suomi (fi) français (fr)

As

La palabra reservada As pertenece a la programación orientada a objetos y se utiliza para convertir (TypeCast) un objeto en una clase. Para ello, el objeto debe ser una instancia de la clase.

Ejemplo:

procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
     (Sender As TDBGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;

Aquí la variable Sender del tipo (type of) TObject se convierte/asigna como (as) tipo (type) TDBGrid.