错误
QVector<LibraryRecord> Library;
Library.push_back(LibraryRecord(DateOfIssue, ReturnDate, FIO,tTekct,FName,TText));
Run Code Online (Sandbox Code Playgroud)
错误信息:
no matching function for call to ‘LibraryRecord::LibraryRecord()’
Run Code Online (Sandbox Code Playgroud)
为什么?构造函数存在
//constructor
LibraryRecord::LibraryRecord(QString pDateOfIssue,
QString pReturnDate,
QString FIO,
QString tTekct,
QString fName,
QString TTextt)
{..}
Run Code Online (Sandbox Code Playgroud)
你能告诉我怎么解决这个问题吗?提前致谢!
Jam*_*lis 11
与C++标准库容器(例如std::vector)不同,Qt容器要求值类型是默认可构造的.
也就是说,您的类型LibraryRecord还必须具有默认构造函数(您显示的构造函数,它需要参数,不是默认构造函数).