Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!zephyr.ens.tek.com!tektronix!reed!glacier!busker!f20.n226.z1.FIDONET.ORG!lanett.mark From: lanett.mark@f20.n226.z1.FIDONET.ORG (lanett mark) Newsgroups: comp.sys.mac.programmer Subject: Methods overriding global functions Message-ID: <677.2783DF3B@busker.fidonet.org> Date: 30 Dec 90 12:44:53 GMT Sender: ufgate@busker.fidonet.org (newsout1.26) Organization: FidoNet node 1:226/20 - cmhGate UF Gateway, Columbus OH Lines: 57 Reply-To: ml27192@uxa.cso.uiuc.edu I'm writing a program using MacApp that for various reasons uses the generic pascal i/o routines like open/close. When I try to call close from a method of a TDocument class the compiler flags an error. The problem is that TDoc _already_ has a method called close, with no arguments, and the compiler is trying to use that one instead of the generic close. I am not using Self, either. I could make the file reference variable a global, and call a special globasl function to close it (which would not be in TDoc), but I'd like to know if there's any way to avoid this sort of thing in the first place. For that matter, why the h*** did Apple give a method a name that would cause this kind of conflict. Yes, I know you don't normally use standard pascal i/o, but I don't really want to rewrite the existing code that does it. Example: I know this won't work. The trouble is it doesn't compile, though it should. How do you get the compiler to use the regular close? program sample (input, output); type foo = object procedure run; procedure close; end; procedure foo.run; var z: text; begin close (z); (* *** Compiler wants to use foo.close (no args) *) end; procedure foo.close; begin writeln ('closing'); end; var a: foo; begin new (a); a.run; end. Thanks much, Mark Lanett, ml27192@uxa.cs.uiuc.edu + Organization: University of Illinois at Urbana -- lanett mark - via FidoNet node 1:105/14 UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!lanett.mark INTERNET: lanett.mark@f20.n226.z1.FIDONET.ORG