On Wednesday, 5 June 2013 at 22:50:27 UTC, Simen Kjaeraas wrote:
On 2013-06-06, 00:32, Adam D. Ruppe wrote:

But I want to clearify this #1:

class A { virtual void foo(); }
class B : A { virtual void foo(); }

With C# semantics (as has been suggested as a basis):

class A {
   virtual void foo() {
       writeln("A.foo");
   }
}

class B : A {
    virtual void foo() {
        writeln("B.foo");
    }
}

void bar() {
    B b = new B();
    A a = b;
    a.foo(); // Prints "A.foo"
    b.foo(); // Prints "B.foo"
}

If that is true, it is fair to assume that C# designer's completely miss the point of OOP.

On the same path, in the previously linked document : Every time you say virtual in an API, you are creating a call back hook.

Which seems that OOP is limited to the observer pattern according to Anders Hejlsberg.

Finally since then, tooling have been introduced in C# to revirtualize everything. This is possible in C# because of the VM, but won't be possible in D.

The whole case about C# isn't very strong IMO.

Reply via email to