qfedu-cpp-level/day7/d9/MyPoint.h

30 lines
384 B
C++

#ifndef __MYPOINT_H__
#define __MYPOINT_H__
#include <iostream>
using namespace std;
template <typename T>
class Point
{
private:
T x, y;
public:
Point(T x, T y);
void show();
};
template <typename T>
Point<T>::Point(T x, T y) : x(x), y(y)
{
}
template <typename T>
void Point<T>::show()
{
cout << "x = " << x << ", y = " << y << endl;
}
#endif // __MYPOINT_H__