Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- class information { //супер класс игфлрмации об организациях
- protected: string name, activity,address;
- public: information(string na, string activ, string addr) {
- name=na;
- activity=activ;
- address=addr;
- }
- void inf_out() {
- cout << "Name of the organization: " << name << endl;
- cout << "Type of activity: " << activity << endl;
- cout << "Legal address: " << address << endl<< endl;
- }
- };
- class theater: public information { //подкласс театр
- private: int capacity;
- public: theater (string na, string activ, string addr, int c): information(na,activ,addr) {
- name=na;
- activity=activ;
- address=addr;
- capacity=c;
- }
- void capacity_out() {
- cout << "Capacity: " << capacity << endl;
- }
- };
- class cafe: public information { // подкласс кафе
- private: int capacity;
- public: cafe(string na, string activ, string addr, int c): information(na,activ,addr) {
- name=na;
- activity=activ;
- address=addr;
- capacity=c;
- }
- void capacity_out() {
- cout << "Capacity: " << capacity << endl;
- }
- };
- int main() {
- information* org1 = new information("showroom 'Lime'", "commercial","NSK, Lenino, 24/3");
- theater* org2 = new theater("Opera and ballet theater", "commercial","Moscow, Frundze, 2/56", 1329);
- cafe* org3 = new cafe("Pop cafe", "commercial","Irkutsk, Mechurina, 16/1", 41);
- org1->inf_out();
- org2->inf_out();
- org2->capacity_out();
- org3->inf_out();
- org3->capacity_out();
- return 0;
- }
Add Comment
Please, Sign In to add comment