你能帮我用 C++ 作曲吗?我有类用户,其中包含:User.h
class User
{
public:
std::string getName();
void changeName(std::string nName);
std::string getGroup();
void changeGroup(std::string nGroup);
User(std::string nName, std::string nGroup);
~User(void);
private:
std::string name;
std::string group;
};
现在我在蜜罐类中定义:
蜜罐.h:
class Honeypot
{
public:
User us;
我有构造函数:
Honeypot (std::string name, std::string ip, int numberOfInterfaces, std::string os);
在 Honeypot.cpp 中:
Honeypot::Honeypot(std::string name, std::string ip, int numberOfInterfaces, std::string os):us(nName, nGroup){
this->name = name;
this->ip = ip;
this-> numberOfInterfaces = numberOfInterfaces;
this->os = os;
}
但是这种语法是不正确的。错误是:
IntelliSense: expected a ')', 'nGroup' : undeclared identifier and more on line :us(nName, nGroup){...
谢谢你的帮助。