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.
我想模拟一个不是类成员的自由函数。
它在 in 中声明.h,其定义在.cpp.
.h
.cpp
如何模拟此功能?
创建模拟函数定义,不要链接原始 .cpp 文件。
这被称为Link Seam,正如 Michael Feathers 在有效使用遗留代码中所描述的那样。