0
更多Pascal困境。Pascal:完全將模塊導入當前範圍
說我有2臺,MainUnit
和ExampleClass
。
MainUnit:
Unit MainUnit;
interface
Uses ExampleClass;
function ReturnFive: Integer;
implementation
function ReturnFive: Integer;
begin
ReturnFive := 5;
end;
begin
end.
ExampleClass中:現在
Unit ExampleClass;
{$mode objfpc}
interface
type
ClassThing = Class
SampleValue: Integer;
end;
implementation
begin
end.
,我想只導入MainUnit
,但仍然能夠使用ClassThing
。 MainUnit
uses ExampleClass
,但當您導入MainUnit
時,ClassThing
不可用。
我真的不想只是use
ExampleClass
連同MainUnit
,我寧願保留在一個uses
聲明。
你是如何做到這一點的?
您不能。但是,如果您只需要訪問ClassThing,則不必使用* MainUnit。 –
@SertacAkyuz所以你只需要將所有東西打包到一個文件中,或者使用一堆不同的模塊? :( –
是的,這是正確的。 –