Say I have an interface IFoo
and I want all subclasses of IFoo
to override Object\'s ToString
method. Is this possible?
Simpl
Jon & Andrew: That abstract trick is really useful; I had no idea you could end the chain by declaring it as abstract. Cheers :)
In the past when I've required that ToString() be overriden in derived classes, I've always used a pattern like the following:
public abstract class BaseClass
{
public abstract string ToStringImpl();
public override string ToString()
{
return ToStringImpl();
}
}