www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: LazyInterface (simplified Boost.Interfaces)

There is no problem if it is only static opDispatch or non-static one.
But D does not allow to override theirs together.

We cannot compile this:
class A{
    int f(){return 10;}
    static int f(){return 20;}
void main(){
	auto a = new A();
	assert(a.f() == 10);
	assert(A.f() == 20);


bearophile wrote:
 But static opDispatch works:

 struct Foo {
    static void opDispatch(string name, Args...)(Args args) {
        static assert(name == "hello");
 void main() {
    Foo.hello(10, 20);

 So if you have found a bug you may add a minimized case in Bugzilla.

Sep 21 2010