shouzama Posted March 20, 2003 Posted March 20, 2003 Coming straight from VB6 (and .NET) to C#, I encountered some "logistic" problems in the way the new MS language handles objects and structs. Let's suppose we have cDummy dummy_obj = new cDummy(dummyparams); cDummy dymmy_copy = null; In VB, an assignment like dummy_copy = dummy_obj simply makes dummy_copy reference the same object referenced by dummy_obj. So, my first question is: - In c#, does the same thing happen? Let's go a little further. Suppose we have a class with a private object of class cDummy, and a property that returns this object private cDummy dummy_obj; public property GetObject { get { return dummy_obj; } } - Does the property returns a COPY of the object or a REFERENCE to the object? If I do: cDummy dummy_copy; dummy_copy = dummyclass.GetObject; does dummy_copy hold a copy of the object in dummyclass OR a reference to the same object? And WHY I can't pass "byref dummyclass.GetObject" to functions? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.