Suppose a construct like this:
class Interface
{
public:
template <typename T>
virtual void reportOperationError(T code , std::string message) = 0;
};
i don't understand the use case for this thing, in which case it is useful, and how?
In case you wonder, I haven't seen this code anywhere, just want to understand if this could have some particular use
Templated member functions cannot be virtual... Each instantiation of the function will add another entry to the virtual table, and the compiler will have to go over all of the code in order to create the vtable. Therefore, regardless of it being useful or not, it's just not legal C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With