Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to declare objects in Delphi

Status
Not open for further replies.

apostolchopov

Programmer
Jun 8, 2004
53
BG
Hi, guys!
Can you, please, tell me how to declare objects in Delphi without having the compiler error message '... is not yet completely defined'?
I tried to declare a class A, then to use it the declaration of another class B and, actually, after this put down the actual declaration of class B. In some cases it worked perfectly well, in other cases it does not work.
For instance:

type A = class;

B = class(TObject)
constructor Create;
function GetAnA : A;
...
end;

A = class(TObject)
constructor Create;
...
end;



 
You need to rearrange your declarations. I expect that class B needs the full declaration of class A before it can parse your function GetAnA. Try this instead:
Code:
A = class(TObject)  
  constructor Create;
  ...
end;

B = class(TObject)
  constructor Create;
  function GetAnA : A;
  ...
end;

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top