class A
{
public int x { get; set; }
// other properties
}
class S
{
public A GetA(...);
}
I would like to make the following restriction:
A
can be only modified inside S
. When someone else get A
via GetA()
, he can only get A
's properties, not modify them.
I decided to make a new function in S
that returns another object:
class B
{
A a;
public int x { get { return a.x; } }
// replicate other A's properties
}
Is there a better solution?