I have been messing with a lille code about 3 days now. And i don't get it...
I might be a bit noob in delphi but maybe someone can help me out..
Should be simple .. i just don't get it...
I want to make a class like that for ex.
- Code: Select all
...
type
THero = class(TObject)
TCPCli : TIdTCPClient;
constructor Create;
procedure connect;
private
....
implementation
..
constructor THero.create;
begin
TCPCli := TidTCPClient.Create(nil);
end;
.....
ok .. now isaved it as MyClass.pas
and use it in my main code
- Code: Select all
uses MyClass, ....
and a piece of code how i want to use it:
- Code: Select all
...
var
Form1: TForm1;
superman :THero ;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
superman.create;
end;
Thing is that it gives me an Access Violation error...
How could i make such a class??
Thanks