Inheritance with interface [closed]

5

How can I solve the following problem.

Scenario: I have a class B that inherits from class A and implements interface I.

Problem: The interface I forces the implementation of method X which in turn is implemented in class A, not in B.

Visual Studio does not recognize this implementation by the parent, what should I do?

    
asked by anonymous 12.06.2014 / 15:51

1 answer

7

Scenario:

public class B: A
{

}
public class A: I
{

    public object X
    {
        get;
        set;
    }
}
public interface I
{
    object X { get; set; }
}

Using:

B b = new B();
b.X = 10;

That is, B inherited all behavior from A , even having a contract with I , then B also has X .

    
12.06.2014 / 16:25