D1/D2: How to check if a method has been overridden

klickverbot see at klickverbot.at
Tue Sep 7 14:41:31 PDT 2010


Putting the overloading issue aside for a moment, how would you 
implement it inside a member function of a (which is required for 
various reasons?

The following does *not* work, because &A.foo also performs a vtbl 
lookup when put inside A…

---
class A {
     void foo() {}
     void bar() {
        auto thisDg = &this.foo;
        writeln(&A.foo is thisDg.funcptr);
     }
}
---

Besides, it also returns a delegate because of this, which is why the 
code does not even compile, but that would be worked around easily.


More information about the Digitalmars-d mailing list