【发布时间】:2019-12-12 09:04:41
【问题描述】:
我不知道为什么我会在这个基本程序上收到这个错误。我什至检查了代码并搜索了这个网站和谷歌的答案。我不明白如何解决我的错误。
链接:
E0289 : No instance of constructor "Phone::Phone" matches the argument list?
no instance of constructor matches the argument list
Error: No instance of constructor matches the argument list
这是我的代码:
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include "trimdecimal.h"
using namespace std;
class Movie {
public:
string title;
string director;
string mainCast1;
string mainCast2;
int yearReleased;
bool isAHit;
int publicLikePercentage;
};
int main()
{
Movie movie1 = Movie("Fast & Furious Presents: Hobbs & Shaw", "David Leitch", "Dwayne Johnson", "Jason Statham", 2019, true, 89);
}
正如我在标题中所说,我收到了这个错误:
E0289 no instance of constructor "Movie::Movie" matches the argument list
我在 Visual Studio 2019 上对此进行了编码
有什么解决办法吗?我将全心全意地感谢任何修复,但请具体说明并向我解释如何解决它,就像您对孩子所做的那样。
【问题讨论】:
-
你在哪里有一个接受 7 个值作为参数的构造函数?实际上,你在哪里定义了任何构造函数?
标签: c++ visual-c++