I want to have a base class with datatypes that will be defined in derived class.
pseudo code
class Base{
public:
void Enroll(vector<int> v){
feature_list.emplace_back(ExtractFeature1(v));
}
vector<double> Compare(vector<int> v){
FeatureType2 ft2 = ExtractFeature2(v);
vector<double> scores;
for (auto &ft1:feature_list){
scores.emplace_back(Compare(ft1, ft2));
}
return scores;
}
protected:
vector<FeatureType1> feature_list;
virtual FeatureType1 ExtractFeature1(vector<int> v)=0;
virtual FeatureType2 ExtractFeature2(vector<int> v)=0;
virtual double Compare(FeatureType1 f1,FeatureType2 f2)=0;
}
So each derived class will implement a different way of extracting and comparing features.
I don't know how to do set some kinds of placeholder type for FeatureType1
and FeatureType2
in Base
class and then force Derived
class to define them. Any advice or guidance would be greatly appreciated.