[ create a new paste ] login | about

Link: http://codepad.org/gtSjCx8c    [ raw code | output | fork ]

C++, pasted on Aug 16:
1
2
3
4
5
6
7
8
9
10
struct Year {
   int year;
   Year(int y) : year(y) {}
   Year() { *this = Year(1970); } // *this = this->operator=(Year(1970));
};

int main() {
   Year y;
   cout << y.year;
}


Output:
1
1970


Create a new paste based on this one


Comments: