You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
460 B
C++

#include <iostream>
#include <memory>
#include "main.h"
int main() {
auto c1 = std::make_shared<Circle>(3.0);
auto c2 = std::make_shared<Circle>(5.0);
auto c3 = std::make_shared<Circle>(7.0);
c1->set_next(c2.get());
c2->set_next(c3.get());
std::cout << "Forward:\n";
for (auto& shape : c1->traverse<IShape::forward>()) {
shape.draw();
}
std::cout << "\nBackward:\n";
for (auto& shape : c1->traverse<IShape::backward>()) {
shape.draw();
}
}