Page Actions
Wiki Actions
User Actions
Submit This Story

运算符重载

#include 
using namespace std;
enum Num { sun,mon,tue,wed,tue,wed,thu,fri,sat};
Num& operator++(Num& n)
{
  return  n =  (nine==n)? zero: Num(n+1);
}

void p(Num& n)
{
  cout << n << endl;
}

int main()
{
  Num k;
  k=zero;
  p(k);
  for(int i=0; i < 15; ++i)
   p(++k);

}

Discussion

Enter your comment
 
 
blog/2006/10/运算符重载.txt · Last modified: 2006/10/01 00:00 (external edit)     Back to top
Recent changes RSS feed Creative Commons License Powered by PHP Driven by DokuWiki