D
Doug
I am thinking there isn't a way to do this but will pose the question
anyways.
I have a component I'm building that contains my business entities. I
have an entity that I want to inherit properties from another. I have
done so like this:
public class FirstEntity : SecondEntity
{
private string _someValue = string.Empty;
public FirstEntity(string someValue, string inheritedValue)
{
InheritedValue = inheritedValue;
_someValue = _someValue;
}
public string SomeValue
{
get
{
return _someValue;
}
}
}
public class SecondEntity
{
string _inheritedValue = string.Empty;
public string InheritedValue
{
get
{
return _inheritedValue;
}
set
{
_inheritedValue = value;
}
}
The problem is, I would prefer not to make the SecondEntity a public
class. I don't want to give anyone the ability to create this class
themselves. I've tried various access modifiers...if I make the second
class an interface, then of course, I have to create the properties I
inherit from it within the FirstEntity, I'd prefer not to do it that
way. Internal or Protected prevent anyone using the FirstEntity class
to see the inherited properties.
Is there some way to do what I'm thinking?
}
/// <summary>Date the script was written.</summary>
public string Date
{
get
{
return _date;
}
set
{
anyways.
I have a component I'm building that contains my business entities. I
have an entity that I want to inherit properties from another. I have
done so like this:
public class FirstEntity : SecondEntity
{
private string _someValue = string.Empty;
public FirstEntity(string someValue, string inheritedValue)
{
InheritedValue = inheritedValue;
_someValue = _someValue;
}
public string SomeValue
{
get
{
return _someValue;
}
}
}
public class SecondEntity
{
string _inheritedValue = string.Empty;
public string InheritedValue
{
get
{
return _inheritedValue;
}
set
{
_inheritedValue = value;
}
}
The problem is, I would prefer not to make the SecondEntity a public
class. I don't want to give anyone the ability to create this class
themselves. I've tried various access modifiers...if I make the second
class an interface, then of course, I have to create the properties I
inherit from it within the FirstEntity, I'd prefer not to do it that
way. Internal or Protected prevent anyone using the FirstEntity class
to see the inherited properties.
Is there some way to do what I'm thinking?
}
/// <summary>Date the script was written.</summary>
public string Date
{
get
{
return _date;
}
set
{