Having something like this this :
public abstract class AAA
{
protected abstract virtual string ToString() // Error
{
// Base Stuff
}
}
public abstract class BBB : AAA
{
public override string ToString()
{
// Use base.ToString();
// More Stuff
}
}
I read another post (http://stackoverflow.com/questions/613327/abstract-method-in-a-virtual-class) witch was pretty like my question, but there is a little difference. I'd like AAA.ToString() to have a base behavior and force the derived class to override it.
I know I could do something like this (scroll down) but I was looking for a proper way.
public abstract class AAA
{
public abstract string ToString();
protected string ToString2()
{
// Base Stuff
}
}
public class BBB : AAA
{
public override string ToString()
{
// Use base.ToString2();
// More Stuff
}
}
I could also probably make a IAAA interface and build my BBB class like
public class BBB : AAA, IAAA { ... }
but don't look right to me.