title: Make parent method return type matching its derivated class type
body: <p>I have a parent class like this:</p>
  
  <pre><code>public class WebserviceResultPerNode 
  {
      public List&lt;DBMappingResult&gt; mapTable { get; set; }
  
      public static WebserviceResultPerNode newInstanceFromError(ErrorResponse error)
      {
          return new WebserviceResultPerNode
          {
              mapTable = null,
              responseCode = error.responseCode,
              responseMessage = error.responseMessage
          };
      }
  }
  </code></pre>
  
  <p>It have some derived classes such as below:</p>
  
  <pre><code>public class WebserviceInsertResultPerNode : WebserviceResultPerNode
  {
  }
  </code></pre>
  
  <p>Now I want to make derived classes like <code>WebserviceInsertResultPerNode</code> such that when I call <code>WebserviceInsertResultPerNode.newInstanceFromError()</code> their return type be same as derived class not parent class. Currently return type of <code>newInstanceFromError</code> is type of parent class, i.e. <code>WebserviceResultPerNode</code>.
  I want to know are there any ways to override <code>WebserviceInsertResultPerNode.newInstanceFromError</code> such that its return type be <code>WebserviceInsertResultPerNode</code> but I don't need to initialize fields of parent class without the need to rewrite them.</p>
  
  <p>How can I rewrite my code to achieve this goal?</p>