Created
June 19, 2025 16:31
-
-
Save Grimitch/8269305d9f73346f71e644489ee1cb5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| class Electrochainik { | |
| public: | |
| string brand; | |
| float volume; | |
| Electrochainik(string brand, float volume) | |
| : brand(brand), volume(volume) {} | |
| void printInfo() { | |
| cout << "Electrochainik: " << brand << ", V: " << volume << " L\n"; | |
| } | |
| }; | |
| class Kniga { | |
| public: | |
| string title; | |
| string author; | |
| Kniga(string title, string author) | |
| : title(title), author(author) {} | |
| void printInfo() { | |
| cout << "Kniga: \"" << title << "\" Autor: " << author << "\n"; | |
| } | |
| }; | |
| class Telephon { | |
| public: | |
| string model; | |
| string os; | |
| Telephon(string model, string os) | |
| : model(model), os(os) {} | |
| void printInfo() { | |
| cout << "Telephon: " << model << ", OC: " << os << "\n"; | |
| } | |
| }; | |
| class Gelevayaruchka { | |
| public: | |
| string color; | |
| float tipSize; | |
| Gelevayaruchka(string color, float tipSize) | |
| : color(color), tipSize(tipSize) {} | |
| void printInfo() { | |
| cout << "Gelevayaruchka: colour " << color << ", width: " << tipSize << " mm\n"; | |
| } | |
| }; | |
| class Cupura { | |
| public: | |
| int value; | |
| string currency; | |
| Cupura(int value, string currency) | |
| : value(value), currency(currency) {} | |
| void printInfo() { | |
| cout << "Cupura: " << value << " " << currency << "\n"; | |
| } | |
| }; | |
| int main() { | |
| Electrochainik kettle("Philips", 1.7); | |
| Kniga book("Мартин Иден", "Джек Лондон"); | |
| Telephon phone("iPhone 14", "iOS"); | |
| Gelevayaruchka pen("синяя", 0.5); | |
| Cupura money(1000, "грн"); | |
| kettle.printInfo(); | |
| book.printInfo(); | |
| phone.printInfo(); | |
| pen.printInfo(); | |
| money.printInfo(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment