Skip to content

AbstractClass

Mehdi Mohammadi edited this page Feb 19, 2014 · 2 revisions

In Java, abstract classes can leave their parent methods unimplemented. But in .Net, those abstract classes, must declare each unimplemented method as an abstract method.

[Java]

public class C extends A
{
    public void IC_Method() {}
}
public abstract class A extends B
{
    public void A_Method(){}
}
public abstract class B implements IC
{
    public abstract int B_Method();
}
public interface IC
{
    void IC_Method();
}

[C#]

public class C : A
{
    public int B_Method() { retrun 0; }
    public void IC_Method() {}
}
public abstract class A : B
{
    public void A_Method(){}
    public abstract int B_Method();
    public abstract void IC_Method();
}
public abstract class B : IC
{
    public abstract int B_Method();
    public abstract void IC_Method();
}
public interface IC
{
    void IC_Method();
}
Clone this wiki locally