Alex Rivera | Logout

Why must the base class be specified before interfaces when declaring a derived class?

Asked 2011-04-15T10:48:27.130
9
public interface ITest
{
    int ChildCount { get; set; }
}

public class Test
{
}

public class OrderPool : ITest, Test
{
    public int ChildCount
    {
        get;
        set;
    }
}

The error says Base class 'Test' must come before any interfaces. Why is it necessary to extend the class first and then implement the inteface?

Edit
Report

1 Answer

2

Simply because the language is designed like that. The reason is probably that a class can have only one base class, but implement any number of interfaces.

answered 2011-04-15T10:51:43.513

Your Answer