1
unknown
plain_text
2 years ago
723 B
2
Indexable
Never
#include <iostream> using namespace std; class zoo{ private: string name; string color; int age; public: zoo(){ name="bear"; color="white"; age=21; } zoo(string namea, string colora, int agea){ set_data(namea, colora, agea); } void set_data(string namea, string colora, int agea){ name = namea; color = colora; age = agea; } void get_data(){ cout << name << " " << color << " " << age << endl; } }; int main() { zoo one; zoo two("horse","brown",3); zoo* three = &two; one.get_data(); two.get_data(); three->set_data("pinguin", "black", 13); three->get_data(); return 0; }