gpt4 book ai didi

c++ - 关于 C++ 宏多态性

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:52:43 26 4
gpt4 key购买 nike

C++有多少种多态类型?宏多态能不能算作C++中的一种多态类型?

最佳答案

多态性的定义来自Wikipedia :

In programming languages and type theory, polymorphism (from Greek πολύς, polys, "many, much" and μορφή, morphē, "form, shape") is the provision of a single interface to entities of different types.

从这个意义上说,将可以使用 C 预处理器宏创建的通用函数/运算符视为一种多态形式是有意义的。

关于c++ - 关于 C++ 宏多态性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25728784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com