Wednesday, February 6, 2013

ostream operator overloading


#include<iostream>

class const_test
{
static const int num=4;
enum{num2=4};
int test[num2];
public:
const_test(){}
~const_test(){}

friend ostream& operator<<(ostream& s,const const_test& c_test);

};

ostream& operator<<(ostream& s,const const_test& r)
{
s<<r.num<<endl;
return s;
}

No comments:

Post a Comment