Is Override Still Mandatory?
    Vijay Nayar 
    madric at gmail.com
       
    Sun Nov 11 18:58:17 PST 2012
    
    
  
I was under the impression that the attribute "override" was 
mandatory when replacing a virtual function in a base class.  
However, code that leaves this out has no errors using dmd v2.060.
import std.stdio;
class A {
   this() {
     show();
   }
   void show() {
     writeln("A");
   }
}
class B : A {
   this() {
     super();
   }
   // No override and no compiler errors?
   void show() {
     writeln("B");
   }
}
void main() {
   auto b = new B();
   // This prints "B".
}
Also, is there a way to make class A call it's own version of 
show()?
  - Vijay
    
    
More information about the Digitalmars-d-learn
mailing list