- Call by Value:
- When formal arguments are modified, if the modification is not reflected on the actual arguments then the concept is called "Call by value".
- Call By Reference (ref):
- When formal arguments are modified, if the modification is reflected on the actual arguments then the concept is called "Call By Reference".
- The ref modifier causes the arguments to be passed by reference.
- The ref modifier has to be used along with formal & actual arguments i.e., the ref keyword has to be used in the method definition and the code that calls it.
- The ref variable must be initializing before passing.
- Call By Out (out):
- The Out parameter is used in cases where you need to return a value from a method, but not pass a value to the method.
- Use Out parameter to return more than one value from the method.
- The Out parameter will not have any initial values but must be assigned a value before the method terminates.
Passing parameters
Subscribe to:
Post Comments
(
Atom
)
0 comments :
Post a Comment