In c++ language, I learned about two phase lookup applied on template.
It said compiler checks twice at template.
But I can't understand the correlation between this pointer and two phase lookup.
So please tell me why removing this pointer (commented region) makes error.
#include <iostream>
using namespace std;
template <class T>
class A {
public:
void f() {
cout << "f()\n";
}
};
template <class T>
class B : public A<T> {
public:
void g() {
//this->f();
}
};
int main()
{
B<int> b;
b.g();
}