Topic: Pointer to class func in class


Author: mwhipple@netcom.com (Mark B. Whipple)
Date: Mon, 11 Apr 1994 17:35:01 GMT
Raw View
I am looking for some help in the area of windows and C++. I require that
a class contain the address of a function contained in that class.
Following is an example of what I am talking about:

class Foo
{
private:
void *Foo.bar;

public:
void bar(void);
}

I am having great difficulty with this situation and would greatly appreciate
any help. Thanks in advance

Mark





Author: LEVITTE@e.kth.se (Richard Levitte)
Date: 12 Apr 1994 14:24:02 GMT
Raw View
In article <mwhippleCo3vIE.1Ft@netcom.com> mwhipple@netcom.com (Mark B. Whipple) writes:

   I am looking for some help in the area of windows and C++. I require that
   a class contain the address of a function contained in that class.
   Following is an example of what I am talking about:

   class Foo
   {
   private:
   void *Foo.bar;

   public:
   void bar(void);
   }

class Foo
{
private:
 void (*Foo::barp)(void);

public:
 void bar(void);
 Foo() : barp(bar) {}
}

That is taken top-of-my-head, but I think it should work.  The important
thing is to not forget to initialize the pointer properly.

--
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! Richard Levitte, VMS GNU Emacs hacker   ! tel: int+46-8-18 30 99            !
! Sulv"agen 57, II                        ! fax: none for the moment          !
! S-126 40 H"agersten                     ! Internet: levitte@e.kth.se        !
! SWEDEN                                  !                                   !
!-----------------------------------------------------------------------------!