誰かがこれを手伝ってくれますか?私はここで新しいです。どんな助けでも大歓迎です!
9.3.cpp:コンストラクター内'Address :: Address(int、std :: string.int.std :: string、std :: String、std :: String)':9.3.cpp:29:51:error:'this '関数として使用することはできません
9.3.cpp:メンバー関数内'int Address :: compareTo(const Address&)':9.3.cpp:39:26:error:'std::string'には'compareTo'という名前のメンバーがありません</p>
#include<iostream>
using namespace std;
class Address {
int houseNumber;
string street;
int apartmentNumber;
string city;
string state;
string zipCode; // e.g., "47405-1234"
Address(int houseNumber,
string street,
// no apartmentNumber
string city,
string state,
string zipCode) {
this->houseNumber = houseNumber;
this->street = street;
this->city = city;
this->state = state;
this->zipCode = zipCode;
}
Address(int houseNumber,
string street,
int apartmentNumber,
string city,
string state,
string zipCode) {
this(houseNumber, street, city, state, zipCode);
this->apartmentNumber = apartmentNumber;
}
void print(void) {
std::cout << "Street: " << street << "\nCity: "
<< city << "\nState: " << state << "\nPostal Code: " << zipCode;
}
int compareTo(const Address &a) {
// same conventions as for Strings
return this->zipCode.compareTo(angel);
}
};