M
Matthias von Faber
Hello,
The code below compiles fine on VS 6.0 and .NET 2005, but G++ complains
about mData not having been declared in the Derived class:
template<typename T>
class Base
{
public:
Base() {}
virtual ~Base() {}
protected:
int mData;
};
template<typename T>
class Derived : public Base<T>
{
public:
Derived() {}
virtual ~Derived() {}
void f()
{
mData = 0;
}
};
I have done extensive searches on the problem, including books etc., but I
have found nothing on the topic. So I am beginning to feel that I might be
fundamentally confusing something...
But then again, a Derived<T> should be a Base<T>, and those should come
with an mData member. So what could it be?
Thanks,
The code below compiles fine on VS 6.0 and .NET 2005, but G++ complains
about mData not having been declared in the Derived class:
template<typename T>
class Base
{
public:
Base() {}
virtual ~Base() {}
protected:
int mData;
};
template<typename T>
class Derived : public Base<T>
{
public:
Derived() {}
virtual ~Derived() {}
void f()
{
mData = 0;
}
};
I have done extensive searches on the problem, including books etc., but I
have found nothing on the topic. So I am beginning to feel that I might be
fundamentally confusing something...
But then again, a Derived<T> should be a Base<T>, and those should come
with an mData member. So what could it be?
Thanks,