[fpc-pascal] How to use var or object in a programm file from a unit file

Michael Van Canneyt michael at freepascal.org
Thu Sep 24 15:54:53 CEST 2009



On Thu, 24 Sep 2009, yu ping wrote:

> Program prog1
> use unit1
> myObj=class
> private
>
> public
>  .....
> end;
> ---------------------------
> unit unit1
> ..............
>
> like above, can i access myObj in unit1?

No.

A unit only has access to symbols that appear in units in it's uses clause.
The program can never appear in the uses clause of a unit, because a unit
can exist without a program.

Michael.



More information about the fpc-pascal mailing list