tags:

views:

135

answers:

2

sorry, just erased my code and did it again, it works now. must have been a silly mistake.

+2  A: 

Wrting this code and compiling works fine

public abstract class BlahA
    {
    }

    public class Blah2 : BlahA
    {
    }

    public class Blah3 : Blah2
    {
        public List<int> MyList()
        {
            return new List<int>();
        }
    }

We will need a bit more of the code that isnt working

EDIT:

from comments you need to implement the method from interface in abstract class.

public interface IBlah
    {
        int GetVal();
    }

    public abstract class BlahA : IBlah
    {
        public int GetVal()
        {
            return 1;
        }

    }

    public class Blah2 : BlahA
    {
    }

    public class Blah3 : Blah2
    {
        public List<int> MyList()
        {
            int i = GetVal();
            return new List<int>();
        }
    }
astander
If he doesn't want to implement the interface method in the abstract class, he doesn't have to. He can declare it as abstract. See my code sample.
BFree
+2  A: 

Well if it's implementing an interface as you posted in your comments, then the problem is that your BlahA class doesn't satisfy the requirements of the interface. There must be some method in the interface (I'm assuming its the MyNewMethod) that you're not implementing in your abstract BlahA class.

If my assumption is correct, add this to your base class:

public abstract List<int> MyNewMethod();

and in your sub class, add the word override to your method declaration.

Some code:

 public interface MyInterface
    {
        void MyMethod();
    }

    public abstract class Base : MyInterface
    {
        public abstract void MyMethod();
    }

    public class SubA : Base 
    {
        public override void MyMethod()
        {
            throw new NotImplementedException();
        }
    }

    public class SubB : SubA
    {
        public void Foo() { }
    }
BFree