Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- template<class T>
- class Test
- {
- T foo;
- int broj;
- public:
- Test(double br)
- {
- foo = br;
- broj = 0;
- }
- T GetFoo()const { return foo; }
- };
- template<class T>
- ostream& operator<< <>(ostream& out, const Test<T>& obj)
- {
- out << "Pi = " << obj.GetFoo() << endl;
- return out;
- }
- int main()
- {
- double x = 3.14;
- Test<double> pi(x);
- cout << pi << endl;
- system("PAUSE>0");
- return 0;
- }
Add Comment
Please, Sign In to add comment