Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!apple!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: Pointers/References to Member Functions Summary: the Z bug Message-ID: <165@mole-end.UUCP> Date: 5 May 89 06:37:08 GMT References: Distribution: comp.lang.c++ Organization: mole-end--private system. admin: mole-end!newtnews Lines: 38 > typedef void A::MEMF; > MEMF* p1 = A:print; // This is accepted by cfront > MEMF& p2 = *A:print; // This results in bus error! Eh? I'm surprised that cfront accepts the first line. Can you explain to me how this is supposed to be a valid statement in the language? > ... If I can get access to the pointer maintaining the link to the member > function of a class, I can change this to point to some function implementing > the appropriate method behavior. This functionality greatly facilitates code > reuse, since it becomes much easier to take an existing class and make a > slight modification to it without having to derive a new class from it. > Any comments? Yeah. If you have source code, why patch the object? COBOL has the ALTER statement: A: GO TO B. . . . ALTER A TO C. Rewrites the goto at A as ``GOTO C'' . The ALTER statement is generally regarded as one of the best ways to rapidly make code maintainance hopeless. I can't see any difference between the ALTER statement and what you are trying to do. In both cases, you are subverting the source-code-to-executable translation by making changes at execution time. What's wrong with deriving classes? How does patching in at execution time facilitate code reuse better than using the source code mechanisms that are provided explicitly for the purpose? -- (This man's opinions are his own.) From mole-end Mark Terribile