Hello,
Here are two classes with a parent/child relation (taken from Unity3D)
public class GameObject
{
...
public T AddComponent<T>() where T : Component;
...
}
public class Component
{
...
public GameObject gameObject { get; }
...
}
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)
I'm asking this because I use the same kind of design and I want to make the setter private.
Thanks