How to call a non-const function within a const function (C++)

后端 未结 7 665
天命终不由人
天命终不由人 2020-12-10 01:06

I have a legacy function that looks like this:

int Random() const
{
  return var_ ? 4 : 0;
}

and I need to call a function within that lega

相关标签:
7条回答
  • 2020-12-10 01:59

    Without using const casts, could you try creating a new instance of the class in the Random() method?

    0 讨论(0)
提交回复
热议问题