title: C++ Call subclass method from superclass
body: <p>I have code of the following style: </p>
  
  <pre><code>class SubClass;
  class SuperClass;
  
  class SuperClass {
  
  private:
  
      void bar() {
  
          SubClass().foo();
      }
  };
  
  class SubClass : SuperClass {
  
  public:
  
      void foo() {};
  };
  </code></pre>
  
  <p>So basically I have a SuperClass from where I want to call a method foo() of the subclass.
  VS 2012 gives me the following errors:</p>
  
  <p>Error 1 error C2514: 'SubClass' : class has no constructors.</p>
  
  <p>Error 2 error C2228: left of '.foo' must have class/struct/union.</p>
  
  <p>What is the correct structure for what I want to do?    </p>