PDA

View Full Version : Kind of constructor



Pirx
22nd March 2015, 19:11
Hi everyone,
I write code of my application and I'd like to know What kind of constructor is called in situation:

QDate date(ui->dateTo->date());
Move constructor or copy constructor?

wysota
22nd March 2015, 21:15
If date() returns a copy and a move constructor is available for QDate then it should be a move constructor. If date() returns a const reference then a copy constructor will be used. It is left as an exercise to the reader to check which is the case :)