Hi,
Does someone knows C# best practice about the way to define attribute visibility (private or protected) behind public property in abstract class or parent class.
In other worlds what is the best practice by default (and why) between:
public abstract class MyClass
{
private string myAttribute;
public string MyAttribute
{
get { return myAttribute; }
set { myAttribute = value; }
}
}
and
public abstract class MyClass
{
protected string myAttribute;
public string MyAttribute
{
get { return myAttribute; }
set { myAttribute = value; }
}
}
I think children class should have the way to handle directly this protected attribute but it may not be a good practice if getter or setter contains more code...
What do you think about that?
Thank you.