template question again

B

booker

The following codes can't pass compilation in vc7.1,
error occured at the possition where Foo is called.

************************************************************8
template<typename type>
class base1
{
template<typename type> class base2;
private:
typedef base2<type> base2type;
public:
virtual void Foo(base2type*)=0;
};

template<typename type2>
class base2
{
};

template<typename type>
class derive
:public base1<type>
,public base2<type>
{
typedef base2<type> base2type;
virtual void Foo(base2type*){}
};

int main(int argc, char* argv[])
{
derive<unsigned> * devptr=new derive<unsigned>;
base1<unsigned> * baseptr=devobj;
baseptr->Foo(devptr);
return 0;
}
 

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

Top