What is the ‘ref’ and ‘out’ parameter?
Ask by Om ji mishra
Updated 23 Oct 2019
REF: - 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"