title: Changing Function Access Mode in Derived Class
body: <p>Consider the following snippet:</p>
  
  <pre><code>struct Base
  {
    virtual ~Base() {}
  
    virtual void Foo() const = 0; // Public
  };
  
  class Child : public Base
  {
    virtual void Foo() const {} // Private
  };
  
  int main()
  {
    Child child;
  
    child.Foo(); // Won't work. Foo is private in this context.
  
    static_cast&lt;Base&amp;&gt; (child).Foo(); // Okay. Foo is public in this context.
  }
  </code></pre>
  
  <p>Is this legal C++? "This" being changing the virtual function's access mode in the derived class.</p>