class State

This commit is contained in:
gandc 2024-05-20 12:47:41 +03:00
parent fd630bd508
commit a9ba899b81
Signed by: gandc
GPG Key ID: 9F77B03D43C42CB4

24
pr6.cpp
View File

@ -4,6 +4,30 @@
using namespace std;
class State {
public:
string name;
string capital;
string language;
long population;
double area;
State() : name(""), capital(""), language(""), population(0), area(0.0) {}
State(string n, string c, string l, long p, double a)
: name(n), capital(c), language(l), population(p), area(a) {}
friend ostream& operator<<(ostream& os, const State& state) {
os << "State: " << state.name << ", Capital: " << state.capital
<< ", Language: " << state.language << ", Population: " << state.population
<< ", Area: " << state.area;
return os;
}
bool operator==(const State& other) const {
return name == other.name;
}
};
template<class T>
class Element {
protected: