Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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++;
    }
};
 
PREVIOUS NEXT
Tagged: #const #function #const #function
ADD COMMENT
Topic
Name
1+9 =