In my C ++ application, I have an interface that looks like this:
class ICalculator
{
public:
virtual double calculateValue(double d) = 0;
};
I have implementations of this interface that look like this:
class MySpecificCalculator
{
public:
virtual double calculateValue(double d);
};
Now my colleague complains about this and tells me that it is better to have a calculateValue method. In this way, we can guarantee that callers always go through the interface and not through a direct implementation.
Is this the right observation? Is it really better to make the interface implementation secure? Or can't we make it private then?
source
share