سلام
کد و خروجی ؟ چه راهی رو پیشنهاد می کنید ؟
تشکر
خروجی :
کد و خروجی ؟ چه راهی رو پیشنهاد می کنید ؟
تشکر
کد:
class tst
{
int x ;
public:
tst(int k=0):x(k) {}
friend ostream & operator << (ostream &cout ,tst & t);
friend istream & operator >>(istream & cin,tst &);
tst operator++()
{return tst(++x);}
tst operator++(int)
{return tst(x++);}
};
ostream& operator << (ostream &cout,tst &t)
{cout << " " << t.x ;return cout ;}
istream & operator >>(istream & cin,tst &t)
{cout << "\nEnter X : ";cin >> t.x;return cin;}
int main(int argc, char* argv[])
{
tst obj1(2);
obj1++;
cout << (++obj1);
}
کد:
[C++ Error] ____.cpp(__): E2094 'operator<<' not implemented in type 'ostream' for arguments of type 'tst'