Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
On Thursday, 8 July 2021 at 12:04:01 UTC, Paul Backus wrote: https://digitalmars.com/articles/b68.html Thank you very much :D

Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:53:42 UTC, Tejas wrote: Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto

Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:53:42 UTC, Tejas wrote: Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto

What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto for pointer to class instances: ``` int