最新回答 / 潇慕粉
友元函数是全局友元函数,调用函数采用函数名(函数参数) 即operator-(coor1) 但如果是成员函数,就可以用对象.的方式调用,即coor1.operator();
2016-09-19
template <typename T>
class Rect
{
public:
Rect(T length, T height);
T calcArea();
T calePerimeter();
public:
T m_length;
T m_height;
};
template <typename T>
Rect<T>::Rect(T length, T height)
template <typename T>
T Rect<T>::calcArea()
template <typename T>
T Rect<T>::calePerimeter()
class Rect
{
public:
Rect(T length, T height);
T calcArea();
T calePerimeter();
public:
T m_length;
T m_height;
};
template <typename T>
Rect<T>::Rect(T length, T height)
template <typename T>
T Rect<T>::calcArea()
template <typename T>
T Rect<T>::calePerimeter()
template <typename T>
void swapNum(T &a,T &b)//交换地址
{
T temp = a;
a = b;
b = temp;
}
void swapNum(T &a,T &b)//交换地址
{
T temp = a;
a = b;
b = temp;
}