I'm attempting to define the power operator ** in a C# class (we'll call it class Foo). I've overridden __pow__()
, which gets me the desired behavior for operations of type Foo ** int
. Unfortunately, I need to also define int ** Foo
, and neither using dynamic values nor overloading __pow__()
gives me the desired behavior; I always receive the error unsupported operand type(s) for **: 'int' and 'Foo'
. I have successfully overridden C#-recognized operators using the operator keyword; both Foo / int
and int / Foo
are functioning successfully. Is there any way to do this with __pow__()
? Thank you in advance.
Asked
Active
Viewed 194 times
1

JustOnePixel
- 689
- 1
- 7
- 16
-
2Did you overload `__rpow__` also? (Probably doesn't have anything to do with this question) – jcao219 Oct 07 '10 at 22:20
-
jaco219 probably has the correct answer. – Dino Viehland Oct 07 '10 at 23:46
-
Jcao219 does indeed have the correct answer! Thanks for the assistance. – JustOnePixel Oct 08 '10 at 14:45