Calling class methods by pointers
Jesse Phillips
jessekphillips+D at gmail.com
Mon Nov 22 16:22:18 PST 2010
wrzosk Wrote:
> The problem i see is that in funcptr there is real entry point for
> method used, not the index in virtual table, so the polymorphism can't
> work with that.
>
> As I have written - i don't know whether it is correct use for delegate.
> Possibly the ptr, funcptr should be both const (Then is it possible to
> call method on object like in C++ ->* or .*?)
> If not, then maybe delegates should work a little different.
You would want something like:
dg(); // Print on foo
dg = &foo2.Print;
dg(); // Print on foo2
dg = &foo2.Print2;
dg(); // Print2 on foo2
More information about the Digitalmars-d-learn
mailing list