C++关于函数重载的问题
C++关于函数重载的问题
已有代码如下:
template <class TMathType, class TLineType>
void
ClassA<TMathType, TPointType>
::FunctionA(LineStartPointer pLine)
{
// Some functions
}
现在需要一个函数重载:
template <class TMathType, class TLineType>
void
ClassA<TMathType, TPointType>
::FunctionA(LineStartConstPointer pLine)
{
// Some functions
}
整个函数实现全部一样,只是参数的类型不同,
一个是普通指针LineStartPointer,
一个是const指针LineStartConstPointer。
// Some functions这里的具体实现完全一样,如果不想复制实现的代码到重载函数,
请问应该怎么办?
谢谢!