HOSOKAWA Kenchi wrote:
Robert Clipsham Wrote:

If you want this then you need abstract classes. http://www.digitalmars.com/d/1.0/attribute.html#abstract

abstract class A
{
   abstract void f(int);
   final void f_twice(int i) { f(i); f(i); }
}

class B : A { }

(new B).f_twice(1);

Unfortunately the derived class have already inherited another class in my code.
I need interface inheritance.


You could use a template mixin then:

template MyInterfaceMethods()
{
  final void f_twice( int i ) { f(i); f(i); }
}

interface I
{
  void f( int );
}

class A : I
{
   mixin MyInterfaceMethods;
}

Reply via email to