I found similar questions and answers like this one. However, as I tried out, this SFINAE tests only succeeded if the tested member is directly defined in the class being te
Unfortunately it wouldn't be possible at least in C++03 and I doubt in C++11 also.
Few important points:
public
private
and protected
inheritance the SFINAE
may end up uselesspublic
method/inheritance,
the code HasFoo::test<>
can be enhanced for taking multiple
parameters where a base class also can be passed;
std::is_base_of<>
can be used for further validation of the
base/derived relationship; then apply the same logic for base class
also