I have the following class that I want to serve as an "interface" for other classes. I am using Eigen library.
class MultivariateDistribution
{
public:
MultivariateDistribution() = default;
template <typename T>
MultivariateDistribution(const Matrix<T, Dynamic, Dynamic> &dataset) { maximumLikelihoodParameterEstimation(dataset); }
virtual ~MultivariateDistribution() = default;
template <typename T>
virtual void maximumLikelihoodParameterEstimation(const Matrix<T, Dynamic, Dynamic> &dataset) = 0;
};
I have dervied a class from this one and implemented all the required methods but the compiler yields the following error:
error C2898: 'void MultivariateDistribution::maximumLikelihoodParameterEstimation(const Eigen::Matrix<T,-1,-1,0,-1,-1> &)': member function templates
cannot be virtual
It is not possible to declare a member function with templated parameters? If so, how can I implement a similar behaviour to receive any type of Eigen Matrix?
Thank you.