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. */
}
请注意,我希望能有两个类答:谢谢乐趣()这两个版本。
当你尝试它时发生了什么? (提示:是的,你可以创建一个模板成员函数。) –
是吗?什么是问题。 –