【发布时间】:2012-01-11 03:35:06
【问题描述】:
例如
class A {
public:
void fun(Array a);
void fun(Vector a);
/* Most codes in these two functions are same. */
/* Can certainly be merged into a template function if they were not member functions. */
}
请注意,我希望在 A 类中同时拥有这两个版本的 fun()。谢谢。
【问题讨论】:
-
你尝试的时候发生了什么? (提示:是的,您可以制作模板成员函数。)