QT Creator下,運行cpp檔案出現不能將引數1從"nullptr"轉換為"const QSharedPointer,,
代碼如下
QSharedPointer<Message> MessageFactory::create(const QString &sender, const QByteArray &data,
int type) const {
switch (type) {
case Message::TextMessage:
// As with std::shared_ptr, a QSharedPointer to a base class can hold a derived class pointer.
return QSharedPointer<Message>(new TextMessage(sender, QString::fromUtf8(data)));
// TODO: handle other message types
}
return nullptr;
}
最后在return nullptr中出錯。不能將引數1從"nullptr"轉換為"const QSharedPointer,,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/53492.html
標籤:基礎類
上一篇:3d列印
