CPP Reference Type

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 May 20 8:5
Editor
Edited
Edited
2023 Apr 25 16:40

Think of it as Array that has 1 element

new feature in C++
  • arg1 must be integer type, is passed by reference
  • arg2 must be integer type, is passed by value
  • arg3 must be double type, is passed by reference
 
 

Two ways of usage

Operator

  1. address of variable when use variable

Type

  1. define reference type variable
    1. 한번 되면 바뀔 수 없다
    2. 변수 alias이므로 자주 메모리 할당 필요없이 변수명만 바꿔주는 동작
 
There shall be no references to references, no arrays of references, and no pointers to references
 
 
 
 

Recommendations