I have been told that references, when they are data members of classes, they occupy memory since they will be transformed into constant pointers by the compiler. Why is tha
Imagine that a class is just a user defined data type. You need to have something which can lead you to the actual thing that you are referencing. Using the actual value in the second case is more about the compiler and his work to optimize your code. A reference should be an alias to some variable and why should this alias use memory when it could be optimized to be taken directly from the stack.