You can't - you cannot declare a method as
abstract
and then provide a body. You can perfectly happily say:
interface I1
{
int Add(int i1, int i2);
}
public abstract class abstClass : I1
{
public int Add(int a, int b)
{
return a + b;
}
}
public class myClass : abstClass { }
...
myClass mc = new myClass();
Console.WriteLine(mc.Add(1, 2));
Or
interface I1
{
int Add(int i1, int i2);
}
public abstract class abstClass : I1
{
public abstract int Add(int a, int b);
}
public class myClass : abstClass
{
public override int Add(int a, int b)
{
return a + b;
}
}
...
myClass mc = new myClass();
Console.WriteLine(mc.Add(1, 2));