> void main() > { > auto pizza = PizzaFactory.factory(); > pizza.doSome(); // OK > pizza.doSomeA(); // error: IPizza.doSomeA() not found > } you interface has only doSome() and that is what factory returns and for all others: factories and cast don't belong together you interface should fit your overall needs