[comp.sys.atari.st] Object oriented programming in C

braner@batcomputer.tn.cornell.edu (braner) (11/13/86)

[]

A while ago I posted a method to do object oriented programming in C.
At the heart of the method is a function that is called every time a
method is being looked up.  This function, called FindMethod, returns
the address of the method - a pointer to a function.  Now how do you declare
a function of that type?  A variable of type pointer to a function which
in turn returns an int is declared as:

	int (*foo)();

and in my posting I declared FindMethod as:

	int (*FindMethod())(token,obp);

Turns out that the correct syntax is:

	int (*FindMethod(token,obp))();

What is surprising is that the compiler I used (Megamax C on the Atari ST)
did not complain, and went on to produce code that did just what I intended!
But other compilers complained.  Thanks to Don Howes that notified me of the
problem.

- Moshe Braner