Re: Overriding a property ?

2016-04-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/14/16 4:54 PM, Lucien wrote: You're right. In fact it didn't work because I did: class A { @property foo() { return false; } void myFunc() { } } class B : A { override @property foo() { return true; } // error override void myFunc() { } }

Re: Overriding a property ?

2016-04-14 Thread Lucien via Digitalmars-d-learn
On Thursday, 14 April 2016 at 20:39:50 UTC, Steven Schveighoffer wrote: On 4/14/16 4:21 PM, Lucien wrote: How can I override a property ? Test code: class A { @property bool foo { return false; } This isn't valid, you need parentheses for foo. This doesn't c

Re: Overriding a property ?

2016-04-14 Thread Satoshi via Digitalmars-d-learn
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

Re: Overriding a property ?

2016-04-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/14/16 4:21 PM, Lucien wrote: How can I override a property ? Test code: class A { @property bool foo { return false; } This isn't valid, you need parentheses for foo. This doesn't compile does it? void myFunc() { ... } } class B : A { overr

Overriding a property ?

2016-04-14 Thread Lucien via Digitalmars-d-learn
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: fun