title: SFINAE to check for inherited member functions
body: <p>Using SFINAE, i <a href="https://stackoverflow.com/questions/257288/possible-for-c-template-to-check-for-a-functions-existence/264088#264088">can detect</a> wether a given class has a certain member function. But what if i want to test for inherited member functions?</p>
  
  <p>The following does not work in VC8 and GCC4 (i.e. detects that <code>A</code> has a member function <code>foo()</code>, but not that <code>B</code> inherits one):</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template&lt;typename T, typename Sig&gt;                                 
  struct has_foo {                     
      template &lt;typename U, U&gt; struct type_check;
      template &lt;typename V&gt; static char (&amp; chk(type_check&lt;Sig, &amp;V::foo&gt;*))[1];
      template &lt;typename  &gt; static char (&amp; chk(...))[2]; 
      static bool const value = (sizeof(chk&lt;T&gt;(0)) == 1);
  };
  
  struct A {
      void foo();
  };
  
  struct B : A {};
  
  int main()
  {
      using namespace std;
      cout &lt;&lt; boolalpha &lt;&lt; has_foo&lt;A, void (A::*)()&gt;::value &lt;&lt; endl; // true
      cout &lt;&lt; boolalpha &lt;&lt; has_foo&lt;B, void (B::*)()&gt;::value &lt;&lt; endl; // false
  }
  </code></pre>
  
  <p>So, is there a way to test for inherited member functions?</p>