[.net] Unions, arrays and safe structs (C# )

Started by
11 comments, last by Holy Fuzz 19 years, 3 months ago
Quote:Original post by dalleboy
"this = tempMatrix" is the illegal part as you cannot overload the operator = in C#, and assignments of 'this' are illegal.

That's correct, but as VizOne noted above, this is valid for structs. In this example (see above posts), Matrix is supposed to be a struct.
- k2"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
Advertisement
Quote:Original post by VizOne
Assignments to this are only illegal for reference types, i.e. classes. For structs it performs a shallow copy.

Ok, thanks for enlightening me... ++VizOne.
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
Lol, my poor little matrix class caused such a stir!

I won't claim that using "this = this * t.GetMatrix();" is good program practice or style, but it DOES work.

This topic is closed to new replies.

Advertisement