/
fedotkinasa
/
structural-patterns
Обзор
Документация
Войти
/
fedotkinasa
/
structural-patterns
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
main.cpp
32 строки
1 KB
fedotkinasa
create main.cpp
20 авг 2025, 18:25
20 авг 2025, 18:25
6adb41f
Код
Авторство
О чём код?
#include <iostream> #include <memory> #include "text_decorators.h" #include "very_heavy_database.h" #include "one_shot_db.h" int main() { // Тестирование декораторов текста auto text = std::make_unique<Text>(); // Paragraph auto paragraph = std::make_unique<Paragraph>(std::move(text)); std::cout << paragraph->render("Hello world") << std::endl; // Reversed auto reversed = std::make_unique<Reversed>(std::make_unique<Text>()); std::cout << reversed->render("Hello world") << std::endl; // Link auto link = std::make_unique<Link>(std::make_unique<Text>()); std::cout << link->render("netology.ru", "Hello world") << std::endl; // Тестирование OneShotDB VeryHeavyDatabase real_db; OneShotDB limit_db(&real_db, 2); std::cout << limit_db.GetData("key") << std::endl; std::cout << limit_db.GetData("key") << std::endl; std::cout << limit_db.GetData("key") << std::endl; return 0; }