<分区>
请帮我解释一下为什么我不能在这种情况下直接调用 func1():
class A {
public:
void func1() {}
};
template <typename wrapped_type>
class B : public wrapped_type {
public:
void func2() {
func1();
}
};
B<A> b;
上述代码在调用 func1() 时导致“error C3861: 'func1': identifier not found”。但是如果我用以下两个选项之一替换这个调用,那么它可以编译成功:
this->func1();
或
wrapped_type::func1();
据我所知,模板类只有在确定所有类型参数时才真正编译。