title: Return value from Derived class to Base class
body: <p>I have a value in the derived class that I want to return using a function from the base class, is that possible? Or do I have to have the variable declared in the base class to do so?</p>
  
  <p>Would I just call the function in the derived class?</p>
  
  <pre><code>class Base
  {
      public:
          int getNum() const { return number; }
  };
  
  class Derived : public Base
  {
      private:
          int n = 50;
  };
  </code></pre>