M
Mike
Hi,
Just a simple question: why the compiler doesn't report error when
accessing a private member function inside a function having template
type ?
For example:
#include<iostream>
using namespace std;
class Testable {
void pp() {} // a private function
};
template <typename T> void goo(const Testable& lhs, const T& rhs) {
lhs.pp(); // it is ok ??
}
void goo2(const Testable& lhs) {
lhs.pp(); // the compiler reports error.
}
Why does the compiler not emit error in function "goo" ?
Thanks.
Mike
Just a simple question: why the compiler doesn't report error when
accessing a private member function inside a function having template
type ?
For example:
#include<iostream>
using namespace std;
class Testable {
void pp() {} // a private function
};
template <typename T> void goo(const Testable& lhs, const T& rhs) {
lhs.pp(); // it is ok ??
}
void goo2(const Testable& lhs) {
lhs.pp(); // the compiler reports error.
}
Why does the compiler not emit error in function "goo" ?
Thanks.
Mike