From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1496 invoked by alias); 21 Oct 2007 14:27:59 -0000 Received: (qmail 1447 invoked by uid 22791); 21 Oct 2007 14:27:59 -0000 X-Spam-Check-By: sourceware.org Received: from mailto1.htwm.de (HELO mailto.htwm.de) (141.55.192.81) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 21 Oct 2007 14:27:56 +0000 Received: from mail.htwm.de ([141.55.192.84]:38062) by mailto.htwm.de with esmtp (Exim 4.24) id 1IjbmY-0005EF-17 for gcc-help@gcc.gnu.org; Sun, 21 Oct 2007 16:27:58 +0200 Received: from [77.64.133.8] (port=45792 helo=[192.168.10.159]) by mail.htwm.de with asmtp (Exim 4.24) id 1IjbmX-0004ue-Ob for gcc-help@gcc.gnu.org; Sun, 21 Oct 2007 16:27:57 +0200 Message-ID: <471B80C0.4090405@web.de> Date: Sun, 21 Oct 2007 21:50:00 -0000 From: Rene Buergel User-Agent: Thunderbird 2.0.0.6 (X11/20070804) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: problems taking a pointer to member-function of a protected method in a derived class Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-10/txt/msg00270.txt.bz2 I don't know, if this list is appropriate, as this is a general C++-Question, but anyway... I ran into some problems with the following Codepiece: class Base { protected: typedef void (Base::*FuncPtr)(); virtual void func(); }; class Derived: public Base { virtual void func(); Derived() { FuncPtr p = &Base::func; } }; g++ tells me, that i can't access it, because it is taken via Base. If the method wouldn't be virtual, it could be referenced as "&Derived::func". Currently the only solution to me seems to make func public - which is not intended by design. Are there other possibilities?