title: Access entire base class from derived class C++
body: <p>I understand that you can access members of the base class from a derived class, however, I have a function that requires a pointer to my base class as a whole. For example:</p>
  <pre><code>#include &lt;iostream&gt;
   
  using namespace std;
  
  function foo(Shape &amp;s){
  //does something
  }
  
  // Base class
  class Shape {
     public:
        Shape(int w = 100, int h = 100){
           width = w;
           height = h;
        }
        void setWidth(int w) {
           width = w;
        }
        void setHeight(int h) {
           height = h;
        }
        
     protected:
        int width;
        int height;
  };
  
  // Derived class
  class Rectangle: public Shape {
     public:
        Rectangle(){
          Shape();
        }
        int getArea() { 
           return (width * height); 
        }
  };
  
  int main(void) {
     Rectangle Rect;
     foo(// Pointer Reference to Rect.Shape here);
  
     return 0;
  }
  </code></pre>
  <p>Is there any way to get a pointer to this base class from the derived class?</p>