Cumulative

Namespace rswhite4 at googlemail.com
Mon Feb 24 16:18:44 PST 2014


Maybe:
----
extend void foo() { ... }
----
would force you to use super.foo() and otherwise gives an error?

----
class Foo {
     void foo() {
         // ...
     }
}

class Bar : Foo {
     extend void foo() {
         // compiler will force you (opposed to override) that you 
call super.foo() but it isn't important where. You can call it at 
the end or at the start or wherever you wish.

     }
}
----

Maybe we could also reduce the super.FUNCTION with "super" as for 
base class constructors. Or to distinguish we could name it 
"base":

----
class Foo {
     void foo() {
         // ...
     }
}

class Bar : Foo {
     extend void foo() {
         base(); /// will be rewritten to super.foo();
     }
}
----

The latter is of course for the "lazy" people. :)


More information about the Digitalmars-d mailing list