passing an object to a manipulator function
hello friends,
i want to pass an object as an argument as follows.
#include <iomanip>
#include <iostream>
using namespace std;
class myclass
{
public :
int m,n;
myclass(){m=10;n=12;}
};
ostream & disp( ostream & output,myclass &obj)
{
output<<"Hello"<<endl;
output<<obj.m;
return output;
}
void main()
{
myclass myobjct;
cout<<disp<<myobjct;
}
Above code does not run.
How to achieve above feature ?
plase help me. its urgent.
thank you.
|