ioc new function for classes with virtual methods