Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在公开招标中有以下声明:
“在面向对象编程中使用泛型类型有助于在编译时进行类型检查。”
这是真的还是假的?我认为这是错误的,因为类型检查编译器没有改进,这与面向对象无关,而是与语言类型(弱类型或强类型)有关。有人请帮我解释为什么这个说法是错误的。
陈述是真实的。使用泛型类型,您可以在实例化对象时指定类型,并且可以在编译时检查其使用情况。如果没有类上的类型参数,就无法检查。