class Cell : public QTableWidgetItem
{
public:
Cell();
QTableWidgetItem *clone() const;
...
}
Above is the class definition in a Qt program. Below is the rest part.
QTableWidgetItem *Cell::clone() const
{
return new Cell(*this);
}
My question is about the last sentence, if I change it to like:
return new Cell(this);
Then Qt will give error message:
Why? I understand that this
is a pointer, and cannot be the argument.
But *this
could be a &
type?