title: Derived Class cannot access Parent class method
body: <p>I am getting an error "class Derived has no member named 'getX'" When I try to compile code like this:</p>
  
  <pre><code>class Base
  {
      public:
          int getX() {return x};
      protected:
          int x;
  
  };   
  
  class Derived : public Base
  {
      public:
          void myFunction(){int y = getX()};
  
  };
  </code></pre>
  
  <p>I contrived this example to help clarify, because I got a lot of errors like this when my derived class tries to use methods from the parent class that it should have inherited. I have tried using the 'this' keyword before the method invocation, but that did not work either. Thanks for any help.</p>