extends and implements
Justin Whear
justin at economicmodeling.com
Mon Nov 7 10:44:16 PST 2011
You can do this and/or use the convention of extends first, implements
second:
class Rectangle : Drawable, IShape, IOtherInterface {}
If you're really concerned about clarity, use comments:
class Rectangle : /* extends */ Drawable,
/* implements */ IShape
{
}
Andrej Mitrovic wrote:
> If you need some kind of textual information on whether its a class or
> an interface, you can name your interfaces with an "I".
>
> interface IShape
> {
> }
>
> abstract class Drawable
> {
> }
>
> class Rectangle : IShape, Drawable {}
>
> It's pretty common in other languages, I've seen it used in D as well.
More information about the Digitalmars-d-learn
mailing list