Search
 
SCRIPT & CODE EXAMPLE
 

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++;
    }
};
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp template 
Cpp :: two elements with difference K in c++ 
Cpp :: C++ String Compare Example 
Cpp :: visual studio getline not working 
Cpp :: long pi in c++ 
Cpp :: enum c++ 
Cpp :: c ++ split_string 
Cpp :: how to make a function in c++ 
Cpp :: passing custom function in sort cpp 
Cpp :: do while c++ 
Cpp :: c++ variable types 
Cpp :: cknuth hash 
Cpp :: c++ fonksion pointer 
Cpp :: loop c++ 
Cpp :: c++ sizeof 
Cpp :: Initialize Vector Iterator 
Cpp :: c++ recorrer string 
Cpp :: put function in cpp 
Cpp :: age in days in c++ 
Cpp :: how to create an integer in c++ 
Cpp :: has substr c++ 
Cpp :: STD::ERASE FUNCTION IN C++ 
Cpp :: c++ sorting and keeping track of indexes 
Cpp :: find factorial in c++ using class 
Cpp :: minimum or maximum in array c++ 
Cpp :: unique element in array in c 
Cpp :: max and min function in c++ 
Cpp :: pragma HLS bracets 
Cpp :: InstallUtil.exe ConsoleApp 
Cpp :: lap trinh file explorer c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =