[Mono-list] reusing interface implementation

Mathias Tausig mtausig at fsmat.at
Tue May 27 06:53:19 EDT 2008


Hy!

I have a class hierarchy which is usable as it is. But now I would like to
extend it with an interface and create something like a parallel
hierarchy. But as far as I can see, it is not possible to implement my
interface only once.
A simple example what I mean:


public class A{
       public A(){}
       public virtual int x{
	 get{return 1;}
       }
}
public class B:A{
       public override int x{
	 get{return 2;}
       }
}

public interface ITest{
       void iF();
}

public class AplusInterface :A,ITest{
  public void iF(){
    Console.WriteLine("x: "+x);
  }
}

And now I would like to have a class "BplusInterface" without having to
implement the interface once again. Is that possible in C#?

cheers
Mathias



More information about the Mono-list mailing list