resource): FactoryInterface;interface FactoryInterface // Cannot be implemented because of contravarianceresource): EntityInterface;class UserFactory implements FactoryInterface // This signature break contravariance
我和我的同事正在为我们的代码库实现Google Test,并且遇到了一些关于使用标准模板容器的Contravariance问题。//takeMyFruit(bananas); //Compile error due to contravariance} 我们需要能够编译一些可以接受容器的基类型的东西,例