title: c# parent-child property protection
body: <p>Here are two classes with a parent/child relation (taken from Unity3D) </p>
  
  <pre><code>public class GameObject
  {
      ...
      public T AddComponent&lt;T&gt;() where T : Component;
      ...
  }
  
  public class Component
  {
      ...
      public GameObject gameObject { get; }
      ...
  }
  </code></pre>
  
  <p>Since only the getter is public, how do they acheive to set the value of the Component gameObject field ? (There is no other methods in the Component class that takes a GameObject)</p>
  
  <p>I'm asking this because I use the same kind of design and I want to make the setter private.</p>
  
  <p>Thanks</p>