Is it possible to have a nested class that is public but can only be instantiated by it s parent class e.g.
public class parent
{
public class child
{
public string someValue;
}
public child getChild()
{
return new child();
}
}
举例来说,儿童班级可以通过父母以外的法典进行。 我希望外部法典能够看到儿童类型,但无法自行制定。
e.g
var someChild = new parent.child();