Thursday, September 2, 2010

Overload the postfix and prefix version of ++


//prefix version of ++
 ThreeD ThreeD::operator++() 

  x++; // increment x, y, and z  
  y++;  
  z++; 
  return *this


//postfix operator ++
ThreeD ThreeD::operator++(int notused

 
  x++;  // increment x, y, and z 
  y++; 
  z++; 
  return *this; // return original value 
}

No comments:

Post a Comment