Why can I call a non-const member function pointer from a const method?

前端 未结 5 782
终归单人心
终归单人心 2020-12-11 05:42

A co-worker asked about some code like this that originally had templates in it.

I have removed the templates, but the core question remains: why does this compile O

5条回答
  •  执笔经年
    2020-12-11 06:39

    One helpful way of thinking about it might be that your X object is not a member of CX at all.

提交回复
热议问题