Why does C++ not have a const constructor?

后端 未结 5 585
生来不讨喜
生来不讨喜 2020-11-29 06:23

(Edit: Heavy change because previous example was flawed, which may make some answers/comments seem odd)

This might be an overly contrived, but the following

5条回答
  •  有刺的猬
    2020-11-29 06:56

    Const objects should initialize their member variables and a const constructor wouldn't be able to do so.

提交回复
热议问题