简体   繁体   English

语句错误:“在 ',' 标记之前应为 ')'

[英]Error with a statement: "expected ')' before ',' token

So I'm very new to coding and although I have found many answers to this same question, none of them seem to work for me.所以我对编码很陌生,虽然我已经找到了很多相同问题的答案,但似乎没有一个对我有用。 I am trying to make a constructor that takes multiple parameters for my class but the compiler always says that it is expecting me to end the constructor after the first string rather than allowing me to include all of the member variables in the one constructor.我正在尝试为我的类创建一个接受多个参数的构造函数,但编译器总是说它希望我在第一个字符串之后结束构造函数,而不是允许我在一个构造函数中包含所有成员变量。

Here's a snip of the constructors I have declared:这是我声明的构造函数的片段:

class studentType
{

public:

studentType();

studentType(string, string, char, int, int, double);

and the error says error expected ')' before ',' token which leads me to believe that it will only let me make a single parameter constructor but I know that that is not true.并且错误error expected ')' before ',' token这让我相信它只会让我创建一个参数构造函数,但我知道那不是真的。 I have 6 member variables in my class and I need a constructor that will initialize all of them.我的类中有 6 个成员变量,我需要一个构造函数来初始化它们。

Any help would be greatly appreciated as I really thought I knew what I was doing and apparently I have no idea.任何帮助将不胜感激,因为我真的以为我知道我在做什么,显然我不知道。

Include the required headers包括所需的标题

#include <string>

using std::string;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM