is const (c++) optional?

前端 未结 11 631
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 21:06

according to some tutorials i read a while back, the \"const\" declaration makes a variable \"constant\" ie it cannot change later.
But i find this con

11条回答
  •  無奈伤痛
    2020-12-11 21:27

    Even if you and everyone you work with never makes mistakes, the use of const in your method declarations helps to document your interface.

提交回复
热议问题