title: Setting base class property using derived class Constructor
body: <p>I am setting a property of base class from derived class as following:</p>
  
  <pre><code>public abstract class Coverter
  {
      public Mydata data { get; set; }
      public abstract void Convert();
  
  }
  public class Mydata
  {
      public int i;
  }
  public class Coverter1 : Coverter
  {
      public Coverter1(Mydata data1)
      {
          data = data1;
      }
  
      public override void Convert()
      {
          Console.WriteLine(data.i.ToString());
  
      }
  }
  
  private static void Main(string[] args)
  {
      Mydata data = new Mydata();
      data.i = 5;
      Coverter c = new Coverter1(data);
      c.Convert();
      Console.ReadLine();
  }
  </code></pre>
  
  <p>Is there any flaw with this kind of implementation ? What could be the better approach?</p>
  
  <p>I can do the same thing in the following approach. </p>
  
  <pre><code>public abstract class Coverter
      {
          public Mydata data { get; set; }
          public abstract void Convert();
  
      }
  
      public class Mydata
      {
          public int i;
      }
      public class Coverter1:Coverter
      {
        override public void Convert()
        {
            Console.WriteLine(data.i.ToString());
  
        }
      }
      static void Main(string[] args)
      {
          Mydata data1 = new Mydata();
          data1.i = 5;
          Coverter c = new Coverter1();
          c.data = data1;
          c.Convert();
          Console.ReadLine();
      }
  </code></pre>
  
  <p>Which appraoch is better?</p>