title: How to encapsulate a property in a base class?
body: <p>My scenario is about developing Math Problems. As a <code>IProblem</code> interface, I thought that the two main properties that it should contain are <code>QuestionText</code> and <code>Response</code>. <code>QuestionText</code> always will be a string, but <code>Response</code> sometimes can be a complex object (a custom <code>Fraction</code> struc) or another datatype like string, decimal, int, etc.</p>
  
  <pre><code>    public interface IProblem
      {
          string QuestionText { get; set; }
          object Response { get; }
  
          bool IsComplete();
          bool IsCorrect();
      }
  </code></pre>
  
  <p>As you can see, <code>Response</code> is object. I guessed this datatype because all problems by nature have a response. And as it's an object, I define only get for future errors (casting problems).</p>
  
  <p>My idea is later, in a concrete class to access to this property (<code>Response</code>), without the necessity to cast. Check it out?</p>
  
  <pre><code>    public abstract class Problem : IProblem
      {
          public string QuestionText { get; set;}
          public object Response { get; protected set; } 
          public virtual bool IsComplete()
          {
              return true;
          }
          public abstract bool IsCorrect();
      }
  
      public class BinaryProblem : Problem
      {
          public decimal N1 { get; set; }
          public decimal N2 { get; set; }
          public decimal Response
          {
              get { return (decimal)base.Response; }
              set { base.Response = value; }
          }
  
          public override bool IsCorrect()
          {
              return N1 + N2 == Response;
          }
      }
  </code></pre>
  
  <p>And here I'm testing the value.</p>
  
  <pre><code>    static void Main(string[] args)
      {
          BinaryProblem p = new BinaryProblem();
          p.N1 = 2;
          p.N2 = 4;
  
          p.Response = 6;
  
          IProblem p2 = p;
          Console.WriteLine(p2.Response);
          Console.WriteLine(p2.IsComplete().ToString());
      }
  </code></pre>
  
  <p>Until now, it works, but I want to know if what I'm doing is correct or a good practice. I've seen another people use <code>new</code> operator to do this. Others don't use the word <code>base</code>.</p>
  
  <p>Is this a good way? Can it be causing future errors? Please, give me a feedback about my design.</p>
  
  <p>EDIT: It's really necessary to access to the Response in a non-generic interface.</p>