The const overload call

Question | Apr 15, 2016 | hkumar 

Consider following case of function overload and override in C++. Only the non-const virtual Foo is overridden in derived class.

struct A  {
  virtual void Foo() const  { 
      std::cout << "const A Foo";
  }
  virtual void Foo() { 
       std::cout << "A Foo";
  }
};

struct B : public A {
   virtual void Foo() { 
      std::cout << "B Foo";
   }
};

B b;
const A* aPtr = &b;
aPtr->Foo();

What is the output of above?

2015 nextptr