template <typename T>
class store // Very basic class, capable of accepting any data-type and does nothing too much
{
public:
store(T value) : value(value) {}
private:
T value;
}
template <>
class store<int> // Inherits all the basic functionality that the above class has and it also has additional methods
: public store<int> // PROBLEM OVER HERE. How do I refer to the above class?
{
public:
store(int value) : store<int>(value) /* PROBLEM OVER HERE. Should refer to the constructor of the above class */ {}
void my_additional_int_method();
}
ここで私は継承に問題があります。ベースクラスはすべての派生クラスと同じ目的で使用されるため、ベースクラスの名前を変更したくない(唯一の違い - 派生クラスには余分なメソッドがほとんどない)テンプレートクラスの継承
は***「thheコードセクションを説明するために、いくつかのコンテキストを追加(または...してくださいそれが見えます。いくつかの詳細を追加してください "***それで気付いたのですか? –
あなた自身が継承するクラスを作ろうとしていますか?どういうことですか?これは特殊化の試みですか? –
http://stackoverflow.com/q/ 27453449/560648 –