Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call global function from within Delphi class's method

Tags:

delphi

Is it possible to call global methods from within a class where they are obscured by member functions of the same name?

I know in C++ you have the following syntax:

int var = 0;

void temp() {
    int var = 2;
    ::var = var;
} //Global var is set to 2
like image 422
JPvdMerwe Avatar asked Mar 09 '26 19:03

JPvdMerwe


2 Answers

Yes you can by using the name of the unit instead of ::

Like:

unit1.var := 2;

See for more details: http://delphi.about.com/od/beginners/l/aa060899.htm

like image 55
AlexV Avatar answered Mar 12 '26 12:03

AlexV


You can try

UnitName.VarName := 2
like image 45
DiGi Avatar answered Mar 12 '26 13:03

DiGi