gpt4 book ai didi

c++ - 重载 C++ == 运算符

转载 作者:行者123 更新时间:2023-11-28 02:28:07 24 4
gpt4 key购买 nike

<分区>

所以有人告诉我,为了让我的程序的一部分工作,我需要重载 == 运算符,不幸的是我完全不知道该怎么做,这是运算符需要的类重载

#ifndef PC_H
#define PC_H
#include <iostream>
#include <list>

using namespace std;

class PC{
protected:
string name;
string IP;
int disk_size;
string pass;
public:
PC();
PC(string, string, int, string);
string getName();
string getIP();
int getSize();
string getPass();
void setName(string);
void setIP(string);
void setNewPass();
void getAllInfo();
};

#endif

我将如何重载 == 运算符,谢谢

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com