What is the ‘ref’ and ‘out’ parameter?
What is the ‘ref’ and ‘out’ parameter?
1186
23-Oct-2019
Updated on 23-Oct-2019
Om ji mishra
23-Oct-2019REF: - In the ref parameter, we pass the parameter by using ‘ref’ keyword. When we pass any ref parameter then we have to assign value in that variable those we have to pass. Without assigning we cannot pass the parameter.
Syntax: - method name(ref value type variable name);
OUT: - In the out parameter, we pass the parameter by using ‘out’ keyword. When we pass any out parameter then we don’t have assign value in that variable those we have to pass.
Syntax: - method name(out value type variable name);
Example: -"OUT"
Example: -"ref"