Examples for Reference return type


// returns reference to returning the original object
date& date::set_year(int y) { year=y; return *this; }

// returns reference to returning the original (incremented) object
date& date::operator++() { next(); return *this; }

// returns value with copy of the temporary object before incrementation
date  date::operator++(int) { date curr(*this); next(); return *curr; }