"instantiated from here" compile error when using template

Y

yinglcs

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);


}
 
P

Pete Becker

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?

This message is a helper for one that came earlier. The earlier one told
you what the error was, and where it occurred. This one points you to
the location where the template with the error was being instantiated.
 
L

Luke Meyers

Pete said:
This message is a helper for one that came earlier. The earlier one told
you what the error was, and where it occurred. This one points you to
the location where the template with the error was being instantiated.

That's compiler-dependent. In my experience, it is a helper for the
message which follows, not the prior.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top