Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!stl!concurrent!concurrent.co.uk!asc From: asc@concurrent.co.uk (Andy Chittenden) Newsgroups: comp.lang.c++ Subject: pointers to member functions Message-ID: <950@sl10c.concurrent.co.uk> Date: 1 Dec 89 08:00:19 GMT Sender: info@concurrent.co.uk Reply-To: asc@concurrent.co.uk (Andy Chittenden) Organization: Concurrent Computer Corp (ESDG), Slough, U.K. Lines: 32 // We are using pointers to member functions with version 1.2. Below is // cut down example. This compiles fine under version 1.2 but doesn't // under version 2. class base { public: int fn1(int p); }; class derived : public base { public: int fn2(int p); }; typedef int (base::*EH_function) (int); class dispatcher { public: dispatcher(EH_function p); }; main() { dispatcher a(base::fn1); dispatcher b(derived::fn2); // fails to compile under v2 } // I can understand why the second line does not compile (derived::fn2 // is not a function of base). However, how is one meant to achieve the // above effect under v2 (pass an arbitrary function of a derived class // with matching parameters)? Thanks in anticipation, Andy Chittenden