title: Can we have a virtual static method ? (c++)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1820477/c-static-virtual-members">C++ static virtual members?</a>  </p>
  </blockquote>
  
  
  
  <p>Can we have a virtual static method (in C++) ? I've tried to compile the following 
  code : </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class A
  {
  public:
      virtual static void f() {cout &lt;&lt; "A's static method" &lt;&lt; endl;}
  };
  
  class B :public A
  {
  public:
      static void f() {cout &lt;&lt; "B's static method" &lt;&lt; endl;}
  };
  
  int main()
  {
      /* some code */
      return 0;
  }
  </code></pre>
  
  <p>but the compiler says that : </p>
  
  <pre><code>member 'f' cannot be declared both virtual and static
  </code></pre>
  
  <p>so I guess the answer is no , but why ? </p>
  
  <p>thanks ,
  Ron</p>