こんにちは!誰かが次の動作を達成またはエミュレートする方法を知っていますか? (このコードはコンパイル時エラーになります)。
たとえば、派生クラスにのみ特定のテンプレートの特殊化を追加したいと思います。
struct Base {
template <typename T> void Method(T a) {
T b;
}
template <> void Method<int>(int a) {
float c;
}
};
struct Derived : public Base {
template <> void Method<float>(float a) {
float x;
}
};