Suppose I want a user to enter a 2D point (x,y). How would I write a template class, in which a user can enter a point of any types?
Example: a user enter..
Enter x: 3
Enter y: 5
or
Enter x: 3.5
Enter y: 5.6
This is what I have so far...
Any help?Code:class myPoint{ public: myPoint(int a, int b) : x(a), y(b) {} ~myPoint() {} protected: int x, y; } template <class T> myPoint<T> { //something??? }