You need to sign in to do that
Don't have an account?
Engine Force
Private set
Do you have examples on how public string str { get; private set;}? I cannot find documentation on how to use private set. Does it mean it can only be set inside a method in the current class?
Thanks!
All Answers
What about protected set? Does it mean only sub-classes can set it? What's the use case that requires using protected set?
And protected method or variables? There is no clear definition on how to use them.
public virtual class c1 {
protected string str;
public virtual class c2 {
protected string str2;
}
public class c3 extends c2 {
protected string str3;
}
}
Also in the online article "OuterClass", it says
// Illegal - cannot call protected method externally
// new OuterClass.ConcreteChildClass().method2();
But this actually compiles fine. Any ideas?