On Thursday, 14 April 2016 at 20:21:38 UTC, Lucien wrote:
How can I override a property ?

Test code:
----------------------------
class A
{
    @property bool foo { return false; }
    void myFunc() { ... }
}

class B : A
{
    override bool foo { return true; } // error
    override void myFunc() { ... }
}
----------------------------
Output error:
function B.foo return type inference is not supported if may override base class function.

Any ideas ?


try

class A
{
    @property bool foo() { return false; }
    void myFunc() { ... }
}

class B : A
{
    override @property bool foo() { return true; } // error
    override void myFunc() { ... }
}

Reply via email to