title: Can I access a base classes protected members from a static function in a derived class?
body: <p>I have a program where I need to make a base class which is shared between a dll and some application code. Then I have two different derived classes, one in the dll one in the main application. Each of these have some static member functions which operate on the data in the nase class. (They need to be static as are used as function pointers elsewhere). In its simplest form my issue is shown below.</p>
  
  <pre><code>class Base {
  protected:
    int var ;
  };
  
  class Derived : public Base {
    static bool Process( Base *pBase ) {
      pBase-&gt;var = 2;
      return true;
    }
  };
  </code></pre>
  
  <p>My compiler complains that I cannot access protected members of pBase even though Derived has protected access to Base. Is there any way around this or am I misunderstanding something?
  I can make the Base variables public but this would be bad as in my real instance these are a lump of allocated memory and the semaphores to protect it for multithreading.</p>
  
  <p>Help?</p>