interfaces :-(
Walter Bright
newshound at digitalmars.com
Thu Mar 9 23:32:37 PST 2006
"John Demme" <me at teqdruid.com> wrote in message
news:dur87c$2m44$1 at digitaldaemon.com...
> Fine. I'll give you a harder example:
>
> interface Map (K,V)
> {
> V get (K k);
> Map copy();
> }
>
> class HashMap (K,V): Map!(K,V)
> {
> V get(K k) {}
> void rehash() {}
> HashMap copy() {}
> }
>
> ... And I've actually run into this problem.
Ok, but it will still work if Map.copy() is defined to return an Object
rather than a Map. I concede it isn't as typesafe, in that whatever is
derived from Object won't necessarilly be implementing Map, but it should
work without ugly casting.
More information about the Digitalmars-d-dtl
mailing list