title: Use of abstract classes, interface and List in C#
body: <p>I have the following code sections and I am trying to implement a method that returns a list. My structure is as follows : abstract class "Coordinates" -> public class "YCoordinate" with my interface pointing to "YCoordinate". I don't want my interface directly chatting to my abstract class as I feel the implementations of my abstract class is responsible for work.  </p>
  
  <p>Interface :</p>
  
  <pre><code>interface IYCoordinate
  {
      System.Collections.Generic.List&lt;Coordinates&gt; GetYCoordinateList();
  }
  </code></pre>
  
  <p>Abstract class :</p>
  
  <pre><code>public abstract class Coordinates
  {
      private int coordinatePriority;
      private int coordinate;
  
      public Coordinates(int CoordinatePriority, int Coordinate)
      {
          this.CoordinatePriority = CoordinatePriority;
          this.Coordinate = Coordinate;
      }
  
      public Coordinates() { }
      public int CoordinatePriority { get { return coordinatePriority; } set { coordinatePriority = value; } }
      public int Coordinate { get { return coordinate; } set { coordinate = value; } }
  
      public virtual List&lt;Coordinates&gt; GetYCoordinateList()
      {
          throw new System.NotImplementedException();
      }
  }
  </code></pre>
  
  <p>Implementation of Interface and abstract class (this is the part that breaks):</p>
  
  <pre><code>public class YCoordinate : Coordinates, IYCoordinate
  {
      public override List&lt;Coordinates&gt; GetYCoordinateList() 
      {
          List&lt;Coordinates&gt; _list = new List&lt;Coordinates&gt;();
          _list.Add(new IYCoordinate(1, 5000));
          _list.Add(new IYCoordinate(2, 100000));
          return _list;
      }
  }
  </code></pre>
  
  <p>However, I am trying to return a list of Coordinates and getting stuck on the public override function in the "YCoordinate" class as I cannot instantiate the Coordinates class directly (because its abstract).  How can I return a list of Coordinates?  The same error happens if I put in IYCoordinate as shown above.</p>
  
  <p>Maybe my implementation is completely wrong? Any recommendation for doing it better would be welcome.  </p>
  
  <p>Later on there will be XCoordinate class and so on. If this approach seems like a bit much its because I am trying to get the hang of the theory behind this.</p>