Ver Mensaje Individual
  #7  
Antiguo 15-05-2006
Avatar de Delphius
[Delphius] Delphius is offline
Miembro Premium
 
Registrado: jul 2004
Ubicación: Salta, Argentina
Posts: 5.582
Reputación: 25
Delphius Va camino a la fama
Pues... que error te produce?

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
{ 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.

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
{ 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.

¿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.
__________________
Delphius
[Guia de estilo][Buscar]
Responder Con Cita