Answers for "how to use a non const function from a const function"

C++
0

how to use a non const function from a const function

struct A
{
    int i=0;
	void foo() const
    {
      const_cast<A&>(*this).func();
    }
  	void func()
    {
      i++;
    }
};
Posted by: Guest on June-01-2021

Code answers related to "how to use a non const function from a const function"

Browse Popular Code Answers by Language