I have the following code, which use template as the parent class of my
other class.
But I have "instantiated from here" compile error at this line:
class C: public B2<A>.
Can some one please tell me why?
class AI {
public:
~AI() {};
virtual void print(int i) = 0;
};
class A {
private:
A(const A& aimpl) {};
public:
int i;
void print(int i) { cout << "hello world " << endl; }
A(): i(9){};
};
template<class T>
class B2: public AI {
public:
~B2() {};
virtual void print(int i) { cout << i<< endl; };
};
class C: public B2<A> { // "instantiated from here" compile error
this line
};
int main(int argc, char **argv) {
C c;
c.print(1);
}