title: Add a private reference to an object
body: <p>I need to add a private reference to a Unit object <code>_Unit</code>. Attached is both classes (<code>Unit</code> and <code>Result</code>).</p>
  
  <p>I understand I need to have the code below, however it results in errors (listed below):</p>
  
  <pre><code>// 14. create new class
  class Result : Unit
  </code></pre>
  
  <p>and the below creates the error that <code>base()</code> requires two constructors:</p>
  
  <pre><code>// 17. Create constructor for the class
  public Result(string grade, Unit _Unit) : base(_Unit)
  </code></pre>
  
  <p>In my unit class there are two private strings <code>_Code</code> and <code>_Name</code>. Please ask if you need any other class codes put in or the assignment question.</p>
  
  <pre><code>namespace SIT232_Assignment1
  {
    // 14. create new class
    class Result
    {
      // 15. Add a private reference to a Unit objectand a private string attributes.
      private string _Grade, _Unit;
  
      // 16. Encapsulate the above attributes with public read-only properties
      public string Grade
      {
          get { return _Grade; }            
      }
  
      // 17. Create constructor for the class
      public Result(string grade, Unit _Unit) 
      {            
          _Grade = grade;            
      }
  
      // 18. create a public read-only property of type bool
      public bool Passed (string grade)
      {
          bool result = true;
          if (_Grade == "N")
              result = false;
          return result;
      }
  
      // 19. Create a public static methods 
      public static bool ValidateGrade(string grade)
      {
          bool result = false;
          if (_Grade == "N" || _Grade == "P" || _Grade == "C" || _Grade == "D" || _Grade =="HD")
              result = true;
          return result;            
      }
  
      // 20. Define a ToString method
      public override string ToString()
      {
          return String.Format("{0}\t{1}", _Grade);
      }
  }
  
  namespace SIT232_Assignment1
  {
    // 8. Create new class
    class Unit
    {
      // 9. Add private string attributes for the unit code and unit name
      private string _Code, _Name;
  
      // 10. Encapsulate the above attributes with public read-only properties.
      public string Code
      {
          get { return _Code; }            
      }                
      public string Name
      {
          get { return _Name; }            
      }     
  
      // 11. Create constructor with two string parameters
      public Unit( string code, string name)
      {
          _Code = code;
          _Name = name;
      }
  
      // 27. create a private list&lt;&gt;
      private List&lt;Student&gt; _EnrolledStudents = new List&lt;Student&gt;();
  
      // 28. Encapsulate the above list with read-only
      public ReadOnlyCollection&lt;Student&gt; EnrolledStudents
      {
          get { return _EnrolledStudents.AsReadOnly(); }
      }
  
      // 29. Create a method that accecpts a single parameter
      public void RecordEnrollment(Student student)
      {
          _EnrolledStudents.Add(student);
      }
  
      // 30. Create a method that accecpts a single parameter
      public void RemoveEnrollment(Student student)
      {
          _EnrolledStudents.Remove(student);
      }
  
      // 12. Define a ToString method
      public override string ToString()
      {
          return String.Format("{0} {1}", _Code, _Name);
      }
  }
  </code></pre>
  
  <p>Furthermore, one other error I'm getting that I simply cannot full understand is the below method HAS to be <em>static</em>, I've researched that also making the attributes and properties of <code>_Grade</code> <em>static</em> solves the error showing on each individual <code>_Grade</code>, however it still shows on the first one?</p>
  
  <pre><code>if (_Grade == "N" || _Grade == "P" || _Grade == "C" || _Grade == "D" || _Grade =="HD")
  
  public static bool ValidateGrade(string grade)
  </code></pre>