View Single Post
  #1 (permalink)  
Old 05-09-2008, 10:50 AM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 254
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
Changing what an operator does dependent on data type

Is it possible to change what an operator does dependent on the variable to the right.

For example:
Code:
//A basic class
class MyClass{
   private:
      float a, b, c;
   public:
      MyClass();
      float operator+ (MyClass);
      //but also do this:
      float operator+ (float a);
};

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote