I know that the = operator cannot be overloaded, but there must be a way to do what I want here:
I just create classes to represent quantitative units, as I do a bit of physics. Apparently, I can't just inherit from the primitive, but I want my classes to behave like primitives - I just want them to type differently.
So I could go
Velocity ms = 0; ms = 17.4; ms += 9.8;
and etc.
I am not sure how to do this. I decided that I would just write a few of these classes:
class Power { private Double Value { get; set; }
But apparently, I cannot overload the assignment operator. Is there any way to get this behavior?
c # operator-overloading
Carson Myers Dec 27 '10 at 9:44 2010-12-27 09:44
source share