title: Overriding classes in c# and accessing a virtual method which uses an override method
body: <p>I am working with overriding methods in C# for the first time and I think I have a good grasp of the basics. However my methods are a little more complex and some call methods within the methods.</p>
  
  <p>I am essentially trying to save myself code writing by finding a way to use the base class method but call the overriden method that the base class method uses.</p>
  
  <p>Here is an example of my problem, as I might not be explaining it too well:</p>
  
  <pre><code>namespace exampleCode
  {
      public class BaseClass : AnotherClass
      {
          public static string OrderStorageContainer = "Deliverables";
  
          public virtual string CustomerStorageContainer = "CustomerDocs";
  
          public virtual string GetSomething(typeStorage st, string FileName)
          {
              if (String.IsNullOrWhiteSpace(FileName))
              {
                  throw new ArgumentNullException("FileName", "The filename of the file should be supplied!");
              }
  
              var c = GetReference(GetName(st));        
              return c.ToString();
          }
          public virtual string GetName(typeStorage st)
          {
              switch (st)
              {
                  case typeStorage.CustomerProvided:
                      return CustomerStorageContainer.ToLower();
                  case typeStorage.SystemGenerated:
                      return OrderStorageContainer.ToLower();
              }
              throw new InvalidOperationException("No container defined for storage type: " + st.ToString());
          }
  
          public virtual string GetReference()
          {
              //does stuff
          }
      }
  
      public class DervivedClass : BaseClass
      {
          public static string QuoteStorageContainer = "QuoteDeliverables";
  
          public override string CustomerStorageContainer = "QuoteCustomerDocs";
  
          public override string GetSomething(typeStorage st, string FileName)
          {
              if (String.IsNullOrWhiteSpace(FileName))
              {
                  throw new ArgumentNullException("FileName", "The filename of the file should be supplied!");
              }
  
              var c = GetReference(GetName(st));        
              return c.ToString();
          }
  
          public override string GetName(typeStorage st)
          {
              switch (st)
              {
                  case typeStorage.CustomerProvided:
                      return CustomerStorageContainer.ToLower();
                  case typeStorage.SystemGenerated:
                      return QuoteStorageContainer.ToLower();
              }
              throw new InvalidOperationException("No container defined for storage type: " + st.ToString());
          }
  
      }
  }
  </code></pre>
  
  <p>Basically, I want the Derived class to use the override GetSomething method. However, I want it to call the Base Class <code>GetReference()</code> method with the result from the overriden <code>GetName()</code> method.</p>
  
  <p>Is this along the right lines? I've been finding it difficult to find a similar exmaple online.</p>
  
  <p>Any pointers would be great!</p>