Inheritance of purity

Michal Minich michal.minich at gmail.com
Fri Feb 17 09:27:11 PST 2012


V Thu, 16 Feb 2012 18:49:40 -0800, Walter Bright wrote:

> Given:
> 
>      class A { void foo() { } }
>      class B : A { override pure void foo() { } }
> 
> This works great, because B.foo is covariant with A.foo, meaning it can
> "tighten", or place more restrictions, on foo.

Will the 'inheritance' of attributes work for interfaces too?

     interface I { void foo() @safe pure nothrow const; }
     class B : I { void foo() { } }  // is it @safe pure nothrow const ?


More information about the Digitalmars-d mailing list