home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!usc!sdd.hp.com!network.ucsd.edu!cogsci!miller
- From: miller@cogsci.ucsd.EDU (Jeff Miller)
- Newsgroups: comp.lang.pascal
- Subject: Turbo Pascal 6.0 OOP Question
- Message-ID: <1535@cogsci.ucsd.EDU>
- Date: 17 Aug 92 17:49:17 GMT
- Organization: University of California, San Diego
- Lines: 36
-
- Is it possible to pass an object's method as a procedure parameter?
- The compiler tells me I am making an illegal function reference
- each time I try to do this.
-
- Here is a crude code-like sketch of what I am trying to do,
- although I know there are other errors here:
-
- Type Generic(Object)
- Function X : Real; Virtual;
- Function Y : Real; Virtual;
- End;
-
- Type RealFunc = Function : Real;
-
- Function Integrate(LowX, HighX : Real; Func : RealFunc);
- Begin
- { Function integration stuff from Numerical Recipes.
- The relevant point is that it calls Func, the function to be integrated. }
- End;
-
- Begin
- Writeln(Integrate(0,1,Object1.X));
- Writeln(Integrate(0,1,Object1.Y));
- End.
-
- At the point of the writeln's,
- The compiler tells me I have an illegal function reference.
-
- If I put in "Far" up by the "Virtual"s, it stops there saying
- that is not an OK thing to do.
-
- Anyone know how to accomplish my goal here?
- Thanks for any info.
-
- Jeff Miller
- jomiller@ucsd.edu
-