Antes que nada... usa las etiquetas [ DELPHI ] y [ /DELPHI ]para que el código que ingresas, sea más legible (debes ingresar sin espacios entre los corchetes.) Pues, mira como queda:
Código Delphi
[-]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
constructor TNumeros.Create(_Fa, _Fb: integer)
begin
Self.Fa:=_Fa;
Self.Fb:=Fb;
end;
function TNumeros.Suma: integer;
begin
Result:=Fa + Fb;
end;
end.
Código Delphi
[-]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
public
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.
¿Pues, que error te produce?
A simple vista el código parece estar bien... ahora no tengo Delphi abierto... y no tengo mucho tiempo como para verlo. En cuanto pueda darte más mano, me fijo.