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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method visibility question

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi All

My boss has just asked me why his method could not be seen from another unit. The method's declaration is Public and he has the unit in his USES clause.

My reply is that he needs prefix the call with the class name eg, Hisclass.hismethod.

He then asked me why this doesn't have to be done with everything else, like ShowMessage or writelns etc. I really didn't know why, is it because these are imported from a DLL ?

Sorry, I should know the answer but don't, one can't know everything [glasses]

I'm interested to know why?

lou
 
In fact, they aren't methods at all; they're procedures. Procedures and functions are globally visible; methods are only accessible via myclass.mymethod. This is because a method only makes sense with reference to some instantiated object (mylist.Add() adds an item to mylist); whereas procedures are not associated with an object, and so can stand alone. -- Doug Burbidge mailto:doug@ultrazone.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top