Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- template <class Data>
- class Point{
- Data x, y;
- public:
- Point(Data a, Data b){
- x = a;
- y = b;
- }
- void Display(){
- cout << "(" << x << ", " << y << ")" << endl;
- }
- };
- int main(){
- Point<int> ob1(5, 9);
- Point<double> ob2(5.6, 9.5);
- ob1.Display();
- ob2.Display();
- return 0;
- }
Add Comment
Please, Sign In to add comment