title: Shallow copy or Deep copy?
body: <p>I am a bit new to these two methods of copying one object into the other. I am confused and unable to spot out the major difference between deep copy and shallow copy.. I had gone through a lots of theory regarding this, but I need explanation with proper examples..
  I have program in which I copy one object into another. --></p>
  
  <pre><code>   class A
      {
          public int a = 0;
          public void display()
          {
              Console.WriteLine("The value of a is " + a);
          }
      }
      class Program
      {
          static void Main(string[] args)
          {
              A ob1 = new A();
              ob1.a = 10;
              ob1.display();
              A ob2 = new A();
              ob2 = ob1;
              ob2.display();
              Console.Read();
          }
      }
  </code></pre>
  
  <p>Is this a shallow copy or a deep copy ? Can anyone please provide the answer with reason. If it is a deep copy, then please provide the code for shallow copy for this program doing the same job of object copying, and the other way around..</p>
  
  <p>If the above is a shallow copy, then even this should be a shallow copy--></p>
  
  <pre><code>            A ob1 = new A();
              ob1.a = 10;
              ob1.display();
              A ob2 = ob1;
              ob2.a = 444;
              ob1.display();
  </code></pre>