如果您有一个名为Box的自定义类,这是Box operator + (const Box& box2){"overload code"}
和Box operator +(Box const& box2){"overload code"}
之间的区别吗?如果是这样,有什么区别?
最佳答案
没有区别。那两个是相同的。 int const&i
,int const& i
,int const &i
,int const & i
,const int&i
,const int &i
,const int& i
,const int & i
都具有完全相同的类型:引用常量int
。
关于c++ - 正确的常量引用语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61448314/