From: sbnaran AT localhost DOT localdomain (Siemel Naran) Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: Casting a class as a function pointer. Date: 13 Jul 1999 15:49:45 GMT Organization: University of Illinois at Urbana-Champaign Lines: 40 Message-ID: References: <378A2FFE DOT D9A4F8A0 AT americasm01 DOT nt DOT com> <378AB489 DOT 75F19B1E AT unb DOT ca> NNTP-Posting-Host: london-9.slip.uiuc.edu X-Newsreader: slrn (0.9.4.3 UNIX) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 13 Jul 1999 03:36:36 GMT, Endlisnis wrote: >Siemel Naran wrote: >> I think that it is possible. Probably something along the lines of this: >> int (operator () *const)(int) { return &f; } > >That gets a parse error before "*". Yes, I know. But I mean that the solution is something along the lines of this, where the "operator" keyword appears after the return type of the returned function. Kind of like for the member function returning a pointer to a non-member or class static function. I tried various combinations, all without any luck. Ask on comp.std.c++ as you might get an answer. Incidentally, how to make an array of function pointers using 'new' and without using 'typedef', and without using containers. With typedef, we say typedef void (*Func)(); Func * array=new Func[1]; delete[] array; Without typedefs, void (**Func)()=new void (*[1])(); // syntax error delete[] array; >> However, operator conversions are rarely a good idea. > > Thanx for the advice, but I'm not actually trying to use this construct, >I'm making a code parser and just wanted to know what to expect. Fine. If you don't know what to do just yet, just have your code parser reject this outright. I don't think anyone writes codes like this anyway. -- ---------------------------------- Siemel B. Naran (sbnaran AT uiuc DOT edu) ----------------------------------