Delphius:
eso intente hacer pero me da un explote, tengo puesto este codigo.
//aqui defino la clase
unit Unit2;
interface
Type
TNumeros = class
private
protected
Fa: integer;
Fb: integer;
public
constructor Create(_Fa, _Fb: integer);
function Suma: integer;
property A:integer read Fa write Fa;
property B:integer read Fb write Fb;
published
end;
implementation
{ TNumeros }
constructor TNumeros.Create(_Fa, _Fb: integer)
begin
Self.Fa:=_Fa;
Self.Fb:=Fb;
end;
function TNumeros.Suma: integer;
begin
Result:=Fa + Fb;
end;
end.
//aqui defino la parte de la forma
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit2, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
numeros: TNumeros;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
numeros.Create(StrToInt(Edit1.Text), StrToInt(Edit2.Text));
Edit3.Text:=IntToStr(numeros.Suma);
end;
end.
mira a ver y dime que podria ser.
gracias
|