Object oriented programming and interfaces

Dirk dirk at mail.com
Mon Dec 4 20:43:27 UTC 2017


Hi!

I defined an interface:

interface Medoid {
     float distance( Medoid other );
     uint id() const @property;
}

and a class implementing that interface:

class Item : Medoid {
     float distance( Item i ) {...}
     uint id() const @property {...}
}

The compiler says:
Error: class Item interface function 'float distance(Medoid 
other)' is not implemented

Is there a way to implement the Item.distance() member function 
taking any object whose class is Item?


More information about the Digitalmars-d-learn mailing list