Pass by value and pass by reference
-
It's passed by the lower intestinal tract.
Deja View - the feeling that you've seen this post before.
I'm cracking up :laugh: I'm shedding tears :(( the people I work with are looking at me like I'm crazy.
-
Value-type objects such as structs are created on the stack, while reference-type objects such as classes are created on the heap. So it is actually a PASS - BY - REFERENCE Both types of objects are destroyed automatically, but objects based on value types are destroyed when they go out of scope, whereas objects based on reference types are destroyed at an unspecified time after the last reference to them is removed. Happy Coding! Mitendra
The object is passed by value, but the what is actually passed since it is a reference object is a pointer to the object. So, the "value" that is actually passed is the pointer not the object and therefore any changes made through the pointer change the original object. What you can't change is the pointer itself. That is the "value". :)
-
The object is passed by value, but the what is actually passed since it is a reference object is a pointer to the object. So, the "value" that is actually passed is the pointer not the object and therefore any changes made through the pointer change the original object. What you can't change is the pointer itself. That is the "value". :)
You are right Jon. I see your point.
-
So If I print the value anywhere inside the Load function will only print 10. But it is not.... Its 30 after function call.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE. How to post a question
When the class object is passed into ChangeMyVar(MyClass objMyClass) it is passed by value. Saying it another way: a copy of the object is made and then used by the ChangeMyVar method. Since this is a copy any changes to it do not affect the original. Bill W