1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
template <typename T>
class A
{
public:
typedef T (A<T>::*InterpolationFunc)(float, float, float) const;
void MA(InterpoaltionType type)
{
// choix de la bonne fonction d'interpolation
InterpolationFunc interpFunc = selectInterpoaltion(type);
// PROBLEME ICI
T val = interFunc(0.0, 0.0, 0.0);
}
InterpolationFunc selectInterpoaltion(InterpoaltionType type)
{
switch(type)
{
case 1 : return &A::interpolation1;
case 2 : return &A::interpolation2;
...
case N : return &A::interpolationN;
}
}
virtual T interpolation1(float, float, float) const = 0;
virtual T interpolation2(float, float, float) const = 0;
...
virtual T interpolationN(float, float, float) const = 0;
};
template <typename T>
class B : public A<float>
{
float interpolation1(float, float, float) const { cout << "interpoaltion 1" << endl; return 0.0; }
float interpolation2(float, float, float) const { cout << "interpoaltion 2" << endl; return 0.0; }
...
float interpolationN(float, float, float) const { cout << "interpoaltion N" << endl; return 0.0; }
}; |
Partager