dynamic_cast
(a)->B::fun();