I read the following SO articles
Everything seems very close to my question and has good answers, but they do not seem to answer my question, except to say that I need to make the method non-static.
example:
abstract public class baseClass
{
private static List<string> attributeNames = new List(new string {"property1","property2"});
virtual public static bool ValidAttribtue(string attributeName)
{
if (attributeNames.Contains(attributeName))
return true;
else
return false;
}
}
class derivedA : baseClass
{
private static List<string> attributeNames = new List(new string {"property3","property4"});
public static override bool ValidAttribute(string attributeName)
{
if (attributeNames.Contains(attributeName))
{
return true;
}
else
{
return base.ValidAttribute(attributeName);
}
}
}
class derivedB : baseClass
{
private static List<string> attributeNames = new List(new string {"property10","property11"});
public static override bool ValidAttribute(string attributeName)
{
if (attributeNames.Contains(attributeName))
{
return true;
}
else
{
return base.ValidAttribute(attributeName);
}
}
}
the resulting A would have the properties 1,2,3,4, and the derivative B would have the properties 1,2,10,11. The list of properties seems to belong to the class and cannot be changed at any time. I would have thought it would be static then.
, , ?
, , , - . - , ?