template <class T>
class A
{
public:
typedef T Foo;
};
template <class T>
class B
{
A<T>::Foo foo;
};
int main()
{
B<int> b;
return 0;
}
test.cpp:11: error: type ‘A<T>’ is not derived from type ‘B<T>’
test.cpp:11: error: expected ‘;’ before ‘foo’
What the FUCK?
Name:
Anonymous2008-12-09 15:27
#include <iostream>
using namespace std;
template <class T>
class A {
public:
void f() {
cout << "lol sepples" << endl;
}
};
template <class T>
class B : public A<T> {
public:
void g() {
f();
}
};
int main() {
B<int> b;
b.g();
}[code]
[code]sepples.cpp: In member function ‘void B<T>::g()’:
sepples.cpp:17: error: there are no arguments to ‘f’ that depend on a template parameter, so a declaration of ‘f’ must be available