Given the following base class:
struct ValueType {
String
ToString(String const& format) const;
};
I want this overload to be called for types deriving from ValueType
:
String FormatValue(const ValueType& value, const String& format)
{
return value.ToString(format);
}
Otherwise, I want this overload to be called:
template <typename T>
String FormatValue(const T& value, const String& format);
How can I ensure that derived types do not instead call the second overload?