This is a C# project.
I have several classes inherited from a base class. Most of the child classes have the same behavior while some of them behave differently.
I'm using the new
keyword.
public class Parent
{
public DataTable FetchScore()
{
// blahblah
}
}
public class ChildNormal : Parent
{
}
public class ChildOdd : Parent
{
public new DataTable FetchScore()
{
DataTable dt = base.FetchScore();
// blahblah
}
}
But the build says using new
is not a good practice.
I cannot use virtual
and override
either, because I want a default. I don't want to copy the same override implementation many times.
How do I do this in C#?