What is the meaning of & in c++?

前端 未结 6 787
走了就别回头了
走了就别回头了 2020-12-03 16:50

I want to know the meaning of & in the example below:

class1 &class1::instance(){

///something to do

}
6条回答
  •  隐瞒了意图╮
    2020-12-03 17:06

    It means that the variable it is not the variable itself, but a reference to it. Therefore in case of its value change, you will see it straight away if you use a print statement to see it. Have a look on references and pointers to get a more detailed answer, but basecally it means a reference to the variable or object...

提交回复
热议问题