Re: Question about interface implementation

2023-05-21 Thread Theo via Digitalmars-d-learn
On Sunday, 21 May 2023 at 11:20:30 UTC, ag0aep6g wrote: On 21.05.23 12:55, Theo wrote: As for the other part, if I use an abstract base class, I *must* indicate when i'm overriding the base class method by explicately saying 'override'. I wouldn't mind if implementing interface methods requir

Re: Question about interface implementation

2023-05-21 Thread ag0aep6g via Digitalmars-d-learn
On 21.05.23 12:55, Theo wrote: As for the other part, if I use an abstract base class, I *must* indicate when i'm overriding the base class method by explicately saying 'override'. I wouldn't mind if implementing interface methods required `override` as well. I don't know if there is a ration

Re: Question about interface implementation

2023-05-21 Thread Theo via Digitalmars-d-learn
On Sunday, 21 May 2023 at 10:33:07 UTC, ag0aep6g wrote: On 21.05.23 12:28, ag0aep6g wrote: Since @trusted functions are guaranteed (by the programmer) to be safe, they are allowed to overload/implement @safe functions/prototypes. *override oh ok. so i can override a @safe interface method w

Re: Question about interface implementation

2023-05-21 Thread ag0aep6g via Digitalmars-d-learn
On 21.05.23 12:28, ag0aep6g wrote: Since @trusted functions are guaranteed (by the programmer) to be safe, they are allowed to overload/implement @safe functions/prototypes. *override

Re: Question about interface implementation

2023-05-21 Thread ag0aep6g via Digitalmars-d-learn
On 21.05.23 11:55, Theo wrote: class MerchantShip : Ship {     private int speed = 0; // If only I had 'private(this)' !!     // how do I know this method is actually an implementation of an interface method     // and not a method specific to this class?     // AND ... how come I can chan

Question about interface implementation

2023-05-21 Thread Theo via Digitalmars-d-learn
see comments in the code below. they are my questions. But feel free to ignore the comment about 'private(this)' ;-) interface Ship { @safe void setSpeed(int speed); @safe int getSpeed(); } class PirateShip : Ship { private int speed = 0; // If only I had 'private(this)' !! //