On 6 okt 2005, at 14:40, [EMAIL PROTECTED] wrote:
I'm trying to migrate MW OO code to FPC. I'm in trouble with this
piece of
MW code:
type
myObjectA = object
.....
lObj: myObjectB;
...
end;
type
myObjectB = object
...
lObj: myObjectA
...
end;
Essentially when the compiler tries to deal with myObjectA, it says
that
'myObjectB is not defined'.
Am I doing something wrong, or is it something not supported by FPC?
You have to use a forward declaration:
type
MyObjectB = object;
myObjectA = object
.....
lObj: myObjectB;
...
end;
myObjectB = object
...
lObj: myObjectA
...
end;
Notes:
a) forward declaration of MacPascal-style objects was not supported
in our initial implementation due to a bug
b) the forward declaration and the full declaration of a type must be
present in the same type-block (which is not the case in your example
above, even if you would add a forward declaration, since there you
start a new type-block for each declaration)
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal