Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp getter as const

// Return a constant bool. One that cannot change values once it's created
const bool isReady() {
    return ready;
}

// A constant function. One that will not change any mmeber variables of the class it belongs to
// This is the style recommended to use for getters,
// 	since their only purpose is to retrieve data and should not modify anything in the process.
bool getReady() const { 
    return ready;
}

Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ namespace 
Cpp :: argument vs parameter coding c++ 
Cpp :: c++ struct constructor 
Cpp :: erase element from vector c++ 
Cpp :: how to split string into words c++ 
Cpp :: string search c++ 
Cpp :: sum of row s2 d array c++ 
Cpp :: iterate through list c++ 
Cpp :: new line in c++ 
Cpp :: opengl draw semi circle c++ 
Cpp :: sort c++ 
Cpp :: word equation numbers 
Cpp :: cpp lambda function 
Cpp :: c++ clip values 
Cpp :: c ++ splitlines 
Cpp :: how to concatenate two vectors in c++ 
Cpp :: c++ tuple 
Cpp :: log base 2 in c++ 
Cpp :: how to write a template c++ 
Cpp :: tuple vector c++ 
Cpp :: C++ sum a vector of digits 
Cpp :: int max in c++ 
Cpp :: c++ namespace example 
Cpp :: resharper fold if statement 
Cpp :: how to make loop in c++ 
Cpp :: Operators in C / C++ 
Cpp :: 344. reverse string c++ 
Cpp :: cyclically rotate an array by once 
Cpp :: find first of a grammar 
Cpp :: c++ string to char* 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =