R
Roy Chastain
I have an abstract base class Abc that has a read-only abstract property p1
public abstract class Abc
{
public abstract string p1
{ get; }
}
I have a derived class Dc that derives from Abc.
public class Dc: Abc
{
public override string p1
{
get { return "string"; }
}
So far so good.
The problem is that I would also like to have a writeable property that is available only to code that has visibility to dc while
code that only has visibility to the definition of Abc only sees the read part of the property.
example
Abc abc
Dc dc
dc.p1 = "dc"; // this would be valid
abc.p1 = "dc"; // this would be a compile error
What is the "correct" way to do this?
Thanks
public abstract class Abc
{
public abstract string p1
{ get; }
}
I have a derived class Dc that derives from Abc.
public class Dc: Abc
{
public override string p1
{
get { return "string"; }
}
So far so good.
The problem is that I would also like to have a writeable property that is available only to code that has visibility to dc while
code that only has visibility to the definition of Abc only sees the read part of the property.
example
Abc abc
Dc dc
dc.p1 = "dc"; // this would be valid
abc.p1 = "dc"; // this would be a compile error
What is the "correct" way to do this?
Thanks