U
Unkown to Xnntp
Hello,
The following code works (it compiles ok with "g++ test.c"):
++++++++++++++++++++++++++++++++++++++++
template <class Value> class Test1 {
public:
int a;
};
class Test2 : public Test1<int> {
public:
void f() {
a = 2;
}
};
++++++++++++++++++++++++++++++++++++++++
However, the following code does not compile:
++++++++++++++++++++++++++++++++++++++++
template <class Value> class Test1 {
public:
int a;
};
template <class Value> class Test2 : public Test1<Value> {
public:
void f() {
a = 2;
}
};
++++++++++++++++++++++++++++++++++++++++
the compiler (g++-4.0.1) says:
test.c: error: a was not declared in this scope
What is the problem?
ps: the code above does not do anything interesting.
It is just here to illustrate the problem that I currently find while compiling
my other real program.
Many thanks,
DAvid
The following code works (it compiles ok with "g++ test.c"):
++++++++++++++++++++++++++++++++++++++++
template <class Value> class Test1 {
public:
int a;
};
class Test2 : public Test1<int> {
public:
void f() {
a = 2;
}
};
++++++++++++++++++++++++++++++++++++++++
However, the following code does not compile:
++++++++++++++++++++++++++++++++++++++++
template <class Value> class Test1 {
public:
int a;
};
template <class Value> class Test2 : public Test1<Value> {
public:
void f() {
a = 2;
}
};
++++++++++++++++++++++++++++++++++++++++
the compiler (g++-4.0.1) says:
test.c: error: a was not declared in this scope
What is the problem?
ps: the code above does not do anything interesting.
It is just here to illustrate the problem that I currently find while compiling
my other real program.
Many thanks,
DAvid