Here is the code,
Code:
class A
{
   public:
     virtual void foo(){}
};

class B : public A
{
   private:
      virtual void foo(){}
};

void main()
{
   B b;
   A* pA = &b;
   pA->foo();
 
}
Obviously when you call pA->foo, it will call foo defined in B. But foo defined in B is private. It is not supposed to be called outside the class B. So it looks like virtual breaks encapsulation.