title: How does one use the IPrintable interface?
body: <p>I'm having some problems with IPrintable interface.</p>
  
  <p>I have class Student class that inherits from the Person class + studentID and class Person (name, lastname). And i have to write a IPrintable with Print() procedure. Print() should print out every field from Person or Student class. Next i have to create 4 objects.</p>
  
  <ol>
  <li>Class object Person assigned to variable of type Person</li>
  <li>Class object Student assigned to variable of type Person</li>
  <li>Class object Student assigned to variable of type Student</li>
  <li>Class object Student <strong>assigned to variable of type IPrintable</strong></li>
  </ol>
  
  <p>Next i have to create list of IPrintable objects and add to this list all created objects and print this objects in loop using Print() method. </p>
  
  <p>Can someone help me with code or show me an article about this interface?</p>
  
  <p>// EDIT</p>
  
  <p>Thanks. I'm still confused about two things. This is my code:</p>
  
  <p>Person.cs</p>
  
  <pre><code>class Person : IPrintable
  {
      public string FirstName;
      public string LastName;
  
      public Person(string FirstName, string LastName)
      {
          this.FirstName = FirstName;
          this.LastName = LastName;
      }
  
      public override string ToString()
      {
          return this.FirstName + " " + this.LastName;
      }
  
  
  }
  </code></pre>
  
  <p>Student.cs</p>
  
  <pre><code>class Student : Person
  {
      public int ID;
  
      public Student(string FirstName, string LastName, int ID) : base(FirstName, LastName)
      {
          this.ID = ID;
      }
  
      public override string ToString()
      {
          return base.ToString() + " [" + this.ID + "]";
      }
  }
  </code></pre>
  
  <p>Program.cs</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          Person o = new Student("John", "Smith", 231312); 
          Console.Write(o.ToString());
  
          return;
      }
  }
  </code></pre>
  
  <p>I have also IPrintable.cs</p>
  
  <pre><code>interface IPrintable
  {
      void Print();
  }
  </code></pre>
  
  <p>Where should I put Print() function to access it from Person and Student class? I don't know how to make an  "Class object Student assigned to variable of type IPrintable". </p>
  
  <p>I think that it will be something like:</p>
  
  <pre><code>IPrintable x = new Student("x", "x", 2231); 
  </code></pre>
  
  <p>But how to make it work?</p>