T
Thomas Witkowski
Hello,
I have a class with one template parameter. When a second class, also
with a template parameter that is forwarded to the first class, is
derived from this class, why it is required to enter the variables of
the first class with this-> ? Here a small example:
template<typename T>
class Class1
{
public:
bool testvar;
};
template<typename T>
class Class2 : public Class1<T>
{
public:
void test123() {
this->testvar = false;
}
};
If I delete this->, so I would just write testvar = false, it does not
work. The compiler (gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52))
returns the error that testvar is not in the current scope. Can
somebody explain it to me?
Regards,
Thomas
I have a class with one template parameter. When a second class, also
with a template parameter that is forwarded to the first class, is
derived from this class, why it is required to enter the variables of
the first class with this-> ? Here a small example:
template<typename T>
class Class1
{
public:
bool testvar;
};
template<typename T>
class Class2 : public Class1<T>
{
public:
void test123() {
this->testvar = false;
}
};
If I delete this->, so I would just write testvar = false, it does not
work. The compiler (gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52))
returns the error that testvar is not in the current scope. Can
somebody explain it to me?
Regards,
Thomas