Calling class methods by pointers

wrzosk dprogr at gmail.com
Mon Nov 22 22:39:24 PST 2010


On 23.11.2010 01:22, Jesse Phillips wrote:
> 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
>
That's obvious to me how to use is. But what is the purpose of read 
write ptr and funcptr ?


More information about the Digitalmars-d-learn mailing list