In the following, am I forgetting some correct syntax for partial specializing class NumInfo or is it even possible to do that?
template<typename T>
struct NumInfo {
T x;
T y;
void Print();
};
template<typename T>
void NumInfo <T>::Print() {
/*.....*/
}
template<typename T>
struct NumInfo <float> {
T x;
float y;
void Print();
};
template<typename T>
void NumInfo <float>::Print() {
/*.....*/
}
Your design has a problem — right now you have multiple classes with the same name
NumInfo<float>and different definitions (depending onT). To fix that, you’ll need a second template parameter, like this: