Re: Problems with pointer-to-members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Sveningsson wrote:
Guilherme Müller skrev:
 > //Here comes the annoying error

void foo2::DoSomething()
{
ReadCallback callback = WhenComplete;
DoAnything(callback);
}


I believe you must write &Foo2::WhenComplete.

I believe that there is also a missing cast to (ReadCallback) since WhenComplete above is of type (foo2::*) and not (foo::*) as ReadCallback is defined.

Is there a way around this? That is, is it possible to define a method pointer type that requires the method to be a member of the base class or any derived class without having to use a cast in assignment? Presumably, the type here, (foo::*) rather than (::*), requires the base class because it intends to manipulate member data?

Not to mention the other two errors in the code of foo2::foo::WhenComplete which should be foo2::WhenComplete along with an accompanying declaration in class foo2.

R.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux