以下代码是我的 C++ 类中幻灯片的一部分。IntelliSence 给我错误,我不知道为什么。不知道为什么它不喜欢构造函数和析构函数。有人可以帮忙吗?
class Vehicle {
friend void guest();
private:
string make;
string model;
int year;
public:
void Vehicle();
void Vehicle(string, string, int);
void ~Vehicle();
string getMake();
}
void guest() {
cout << make;
}
1) IntelliSense: member function with the same name as its class must be a constructor
2) IntelliSense: member function with the same name as its class must be a constructor
3) IntelliSense: return type may not be specified on a destructor