c++ return this code example
Example 1: return use in c++
Terminates the execution of a function and returns control to the calling function (or to the operating system if you transfer control from the main function). Execution resumes in the calling function at the point immediately following the call
Example 2: retu7rn this c++
class myclass {
public:
myclass* ReturnPointerToCurrentObject() { return this; }
const myclass* ReturnPointerToCurrentObject() const { return this; }
myclass& ReturnReferenceToCurrentObject() { return *this; }
const myclass& ReturnReferenceToCurrentObject() const { return *this; }
myclass ReturnCopyOfCurrentObject() const { return *this; }
};
Example 3: return function in cpp
void printChars(char c, int count) {
for (int i=0; i<count; i++) {
cout << c;
}
return;
}