函数引用参数加const

Fun(const Type& type);

在引用传递的时候,在函数内部改变参数,会改变参数实际值。

加上了const就不能被修改。

猜你喜欢

转载自www.cnblogs.com/judes/p/9263392.html