super-interfaces
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Tue Apr 24 20:10:46 PDT 2007
Bill Baxter wrote:
> I think this may be a bug with super-interfaces.
> It's telling me that something is not an override, when, in fact, it is.
>
> Here's the setup:
>
> interface Fruit
> {
> ... // some methods
> }
> interface Vehicle
> {
> void drive_around();
> ... // some other methods
> }
> interface MobileFruit : Fruit, Vehicle
> {
> // nothing here, should inherit from superinterfaces
> }
>
> class BaseFruit : Fruit
> {
> // implement (some of) Fruit's methods here
> }
>
> class MobileFruitGundam : BaseFruit, MobileFruit
> {
> // implement what's not in BaseFruit already
>
> override void drive_around() {..} // from Vehicle
> }
>
> The last part doesn't work. It tells me that drive_around is not an
> override. But it works if I don't tag it with 'override'.
>
> Is that a bug?
>
> --bb
I don't think it is. As I understand it, 'override' only masks a virtual function
implementation or 'abstract' placeholder. Interfaces do not provide implementations nor
placeholders, only a contract requiring certain signatures exist. The main use of
'override' is to catch non-back-compatible API changes.
-- Chris Nicholson-Sauls
More information about the Digitalmars-d-bugs
mailing list