Confusion of function parameters and variables

There are two ways to access variables: by value and by reference, parameters can only be passed by value

The two operations are different, one is access, the other is transfer (copy) , pay attention to the words, otherwise it is very difficult to understand why the parameters of the function are passed by value

object

tip1. The action of the parameter is to pass, that is, to copy the reference of the object to the parameter. The reference is by value.

tip2, accessing a variable object is to access the object in the heap memory through the reference value stored in the variable (the address of the object in the heap memory)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326989341&siteId=291194637