title: C# - advanced inheritance
body: <p>Please take a look at my class structure. I think I would like to have more fun with inheritance than it is possible.</p>
  
  <p>First there is a base abstract class:</p>
  
  <pre><code>public abstract class PolicyDetailed
  {
      internal abstract DataContainer GetActiveAsset();
  }
  </code></pre>
  
  <p>Next there is another abstract class, which is generic:</p>
  
  <pre><code>public abstract class PolicyDetailed&lt;T&gt; : PolicyDetailed where T : DataContainer
  {
      internal new abstract T GetActiveAsset();
  }
  </code></pre>
  
  <p>Lastly there is a specific policy class. AccidentContainer inherits from DataContainer:</p>
  
  <pre><code>public class PolicyAccident : PolicyDetailed&lt;AccidentContainer&gt;
  {
      internal override AccidentContainer GetActiveAsset()
      {
          return null;
      }
  }
  </code></pre>
  
  <p>During compilation I get the following error:</p>
  
  <pre><code>'PolicyAccident' does not implement inherited abstract member 'PolicyDetailed.GetActiveAsset()'  
  </code></pre>
  
  <p>I am not sure what modifiers I should use here to get it to work. Maybe I should also write what I would like to achieve: I have a collection of policy objects of different type (e.g. PolicyAccident, PolicyTravel etc.) which inherit from PolicyDetailed with different types of DataContainer (AccidentContainer, TravelContainer etc.). I would like to call "GetActiveAsset" method on each of them without knowing their specific type and referencing them through PolicyDetailed. At the same time I would like each class to return their specific Datacontainer subclass. Is that possible?</p>