if c++ has no reference type, then what is this

int& ref; ?? :D

In c++, int& declares a formal parameter which is be passed by reference to the function. Passing by reference is not the same as using a Reference Type. This is an important distinction because, in Java for example, all parameters are passed by value. The method receives a copy of the Reference. In C# one can pass any type, Reference Type or Value Type, either by reference or by value, the default is by value.

The closest thing C++ has to a Reference Type is a pointer type, which can also be passed by reference. int*&

Start a discussion about improving the Reference type page

Start a discussion