   [C#] OOP problem
  Hey guys, I'm at a loss on how to fix this, I'm hoping one of you guys can help!I've been coding my XNA game for about a week now, and am getting to the stages of putting the actual game together, where I'll need multiple instances of objects, and that sort of thing.I have two classes, my player and the floor. Both classes have private instances of the Rectangle struct which I use for collision detection.I also have a map class which holds the instances of these two classes and binds the game world together.I use an accessor to try to pass the instance of the Rect struct from the floor class to the collision code in the player class, but it needs to have an object reference to work. This is a problem since all the object references are in the map class.So my problem is I need to access an object reference from an outside class. Is there a way I can do this?If something is unclear then please ask for me to clarify. Its been a while since I've seriously programmed so I wouldn't be surprised if I have some terminology wrong.   
  Let me make sure I understand:  You want to share the same object between classes, but can't since it's a value-type?If so, one solution is to make a wrapper class that contains the struct, so that you can share the reference-type.  This way both of your other classes can modify the shared struct through the wrapper.   ;  In C#, structs are value types while classes are reference types. One option, if I understand your problem correct, is to roll your own Rectangle class, and make it a class, not a struct.edit:Nypyrens suggestion probably solves your technical issue better than mine. However, the distinction between value and reference types is worth a note.[Edited by - pulpfist on June 17, 2009 11:24:16 PM];  would it be easier if you pass the player into the rectangle class to do the collision check rather than the otherway around?  I think then all you would need to do is pass in the current players position into your class.   ;  Thanks for the great suggestions everyone! And a special thanks to pulpfist for pointing that out about structs, I didn't know that.After sleeping on it I decided the easiest thing to do would be to reorganize my code a little, by moving collision detection code to the map class instead of having each class handle its own collisions. This solved my problem perfectly.Thanks again everyone!   