Of course, you should do this on a reference type. Doing it on a
structure is a bit redundant.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
apm said:
in message apm,
Inheritance and the = operator being overloaded are two different
things. First, you can not inherit from value types.
Second, you can not overload the = operator.
Why did you think that using a value type would allow you to
overload the = operator?
The = does what I want it to do in a value type. I don't have to
overload it. I just wanted to 'have my cake and eat it too'. Why won't
inheritance work with value types?
You might be able to get away with what you are doing by overloading
the casting (implicit and explicit).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Recently I have had to use a value type for a complex structure
because I don't know how to override the = operator. Can the operator
ever be overloaded? Or can inheritance be used with value types?