The following codes can't pass compilation in vc7.1,
error occured at the possition where Foo is called.
*************** *************** *************** *************** 8
template<typena me type>
class base1
{
template<typena me type> class base2;
private:
typedef base2<type> base2type;
public:
virtual void Foo(base2type*) =0;
};
template<typena me type2>
class base2
{
};
template<typena me 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;
}
error occured at the possition where Foo is called.
*************** *************** *************** *************** 8
template<typena me type>
class base1
{
template<typena me type> class base2;
private:
typedef base2<type> base2type;
public:
virtual void Foo(base2type*) =0;
};
template<typena me type2>
class base2
{
};
template<typena me 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;
}
Comment