{"id":459682,"date":"2025-05-14T15:01:11","date_gmt":"2025-05-14T15:01:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=459682"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=459682","title":{"rendered":"<span>\u041e\u041e\u041f \u0438\u043b\u0438 \u043d\u0435 \u041e\u041e\u041f \u2014 \u0432\u043e\u0442 \u0432 \u0447\u0451\u043c \u0440\u0435\u0432\u044c\u044e<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/p\/908422\/\" rel=\"noopener noreferrer nofollow\">\u00ab\u041e\u041e\u041f \u043d\u0435 \u043c\u0435\u0440\u0442\u0432\u043e. \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0438\u043c \u043a\u0430\u043a \u043c\u043e\u043b\u043e\u0442\u043a\u043e\u043c \u043f\u043e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435\u00bb<\/a> \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a\u0438\u043f\u0435\u043b\u0438<\/p>\n<p>\u041a\u0442\u043e-\u0442\u043e \u0437\u0432\u0430\u043b Smalltalk, \u043a\u0442\u043e-\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u043b \u0432 \u043d\u0430\u0441 Haskell, \u043a\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u043b \u0438\u0437-\u043f\u043e\u0434 \u043a\u0440\u043e\u0432\u0430\u0442\u0438 \u043f\u043e\u0434\u0448\u0438\u0432\u043a\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u00abECS \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e\u00bb \u2014 \u0438 \u0432\u0441\u0451 \u044d\u0442\u043e \u0441 \u043f\u0440\u0430\u0432\u0435\u0434\u043d\u043e\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u0427\u0442\u043e \u0436\u2026<\/p>\n<p>\u041f\u043e\u0440\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0441\u043f\u043e\u0440 \u043d\u0430 \u0441\u043b\u043e\u0432\u0430\u0445. \u0418 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043f\u043e\u0440 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<h3>Code-Battle: MVP \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430<\/h3>\n<ul>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430: \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u0433\u0443\u0440\u044b: \u0442\u043e\u0447\u043a\u0430, \u043b\u0438\u043d\u0438\u044f, \u043a\u0440\u0443\u0433, \u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0440\u043e\u043c\u0431, \u043e\u0432\u0430\u043b<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c: \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0438\u0433\u0443\u0440 \u043d\u0430 \u043a\u0430\u043d\u0432\u0430\u0441, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u0430:<\/h3>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d .cpp \/ .py \/ .exs \/ .c \/ .rs \/ .lisp \/ whatever \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u042f\u0437\u044b\u043a \u0438 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 \u043b\u044e\u0431\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435: \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>MVP \u0441\u0435\u0439\u0447\u0430\u0441 \u2014 \u0444\u0438\u0447\u0438 \u043f\u043e\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c Merge Request<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0438, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e: \u043d\u0430\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0435\u0432\u0438\u043d\u043e\u0432\u043d\u044b\u0445 \u0438 \u043d\u0430\u0433\u0440\u0430\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0438\u0447\u0430\u0441\u0442\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<h2>\u0414\u043b\u044f \u0437\u0430\u0442\u0440\u0430\u0432\u043a\u0438: C++ \/ \u041e\u041e\u041f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (v1)<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u0441\u0447\u0451\u0442\u0430 \u2014 \u043d\u0430\u0448 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u041e\u041e\u041f, \u0431\u0435\u0437 \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0439.<br \/> \u0412\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435.<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt;  class Shape { public:     virtual void draw() const = 0;     virtual std::string name() const = 0;     virtual ~Shape() {} };  class Point : public Shape {     int x, y; public:     Point(int x, int y) : x(x), y(y) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Point at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y &lt;&lt; \u00ab)\\\\n\u00bb;     }     std::string name() const override { return \u00abPoint\u00bb; } };  class Circle : public Shape {     int x, y, r; public:     Circle(int x, int y, int r) : x(x), y(y), r(r) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Circle at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y &lt;&lt; \u00ab), r = \u00ab &lt;&lt; r &lt;&lt; \u00ab\\\\n\u00bb;     }     std::string name() const override { return \u00abCircle\u00bb; } };  class Rectangle : public Shape {     int x, y, w, h; public:     Rectangle(int x, int y, int w, int h) : x(x), y(y), w(w), h(h) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Rectangle at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y                   &lt;&lt; \u00ab), \u00ab &lt;&lt; w &lt;&lt; \u00abx\u00bb &lt;&lt; h &lt;&lt; \u00ab\\\\n\u00bb;     }     std::string name() const override { return \u00abRectangle\u00bb; } };  class Canvas {     std::vector&lt;Shape*&gt; shapes; public:     void add(Shape* s) { shapes.push_back(s); }     void render() const {         for (auto s : shapes) s-&gt;draw();     }     ~Canvas() {         for (auto s : shapes) delete s;     } };  int main() {     Canvas canvas;     canvas.add(new Point(1, 1));     canvas.add(new Circle(5, 5, 3));     canvas.add(new Rectangle(0, 0, 6, 3));      canvas.render();     return 0; }<\/code><\/pre>\n<h3>\u0422\u0435\u043f\u0435\u0440\u044c \u2014 \u0432\u044b.<\/h3>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0438 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u043d\u0435\u0440\u0435 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e\u0439, \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0441\u043a\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u0411\u0435\u0437 \u043c\u0430\u0433\u0438\u0438. \u0422\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/p>\n<\/li>\n<\/ul>\n<h3>\u042d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u043e.<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0432 \u043f\u0443\u0442\u0438. \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f. \u041a\u0430\u043d\u0432\u0430\u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0441\u044f. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u044f\u0432\u0438\u0442 \u0441\u0435\u0431\u044f.<\/p>\n<p>\u0410 \u043c\u044b, \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u2014 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0434\u0451\u043c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441:<br \/> \u00abTo OOP or not to OOP \u2014 \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u0430\u201d.<\/p>\n<h3>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438:<\/h3>\n<p><a href=\"https:\/\/github.com\/Kahelman\/habr-oop-battle\" rel=\"noopener noreferrer nofollow\">\u041e\u041e\u041f \u0411\u0430\u0442\u0442\u043b \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/909368\/\"> https:\/\/habr.com\/ru\/articles\/909368\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/p\/908422\/\" rel=\"noopener noreferrer nofollow\">\u00ab\u041e\u041e\u041f \u043d\u0435 \u043c\u0435\u0440\u0442\u0432\u043e. \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0438\u043c \u043a\u0430\u043a \u043c\u043e\u043b\u043e\u0442\u043a\u043e\u043c \u043f\u043e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435\u00bb<\/a> \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a\u0438\u043f\u0435\u043b\u0438<\/p>\n<p>\u041a\u0442\u043e-\u0442\u043e \u0437\u0432\u0430\u043b Smalltalk, \u043a\u0442\u043e-\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u043b \u0432 \u043d\u0430\u0441 Haskell, \u043a\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u043b \u0438\u0437-\u043f\u043e\u0434 \u043a\u0440\u043e\u0432\u0430\u0442\u0438 \u043f\u043e\u0434\u0448\u0438\u0432\u043a\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u00abECS \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e\u00bb \u2014 \u0438 \u0432\u0441\u0451 \u044d\u0442\u043e \u0441 \u043f\u0440\u0430\u0432\u0435\u0434\u043d\u043e\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u0427\u0442\u043e \u0436\u2026<\/p>\n<p>\u041f\u043e\u0440\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0441\u043f\u043e\u0440 \u043d\u0430 \u0441\u043b\u043e\u0432\u0430\u0445. \u0418 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043f\u043e\u0440 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<h3>Code-Battle: MVP \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430<\/h3>\n<ul>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430: \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u0433\u0443\u0440\u044b: \u0442\u043e\u0447\u043a\u0430, \u043b\u0438\u043d\u0438\u044f, \u043a\u0440\u0443\u0433, \u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0440\u043e\u043c\u0431, \u043e\u0432\u0430\u043b<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c: \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0438\u0433\u0443\u0440 \u043d\u0430 \u043a\u0430\u043d\u0432\u0430\u0441, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u0430:<\/h3>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d .cpp \/ .py \/ .exs \/ .c \/ .rs \/ .lisp \/ whatever \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u042f\u0437\u044b\u043a \u0438 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 \u043b\u044e\u0431\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435: \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>MVP \u0441\u0435\u0439\u0447\u0430\u0441 \u2014 \u0444\u0438\u0447\u0438 \u043f\u043e\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c Merge Request<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0438, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e: \u043d\u0430\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0435\u0432\u0438\u043d\u043e\u0432\u043d\u044b\u0445 \u0438 \u043d\u0430\u0433\u0440\u0430\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0438\u0447\u0430\u0441\u0442\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<h2>\u0414\u043b\u044f \u0437\u0430\u0442\u0440\u0430\u0432\u043a\u0438: C++ \/ \u041e\u041e\u041f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (v1)<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u0441\u0447\u0451\u0442\u0430 \u2014 \u043d\u0430\u0448 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u041e\u041e\u041f, \u0431\u0435\u0437 \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0439.<br \/> \u0412\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435.<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt;  class Shape { public:     virtual void draw() const = 0;     virtual std::string name() const = 0;     virtual ~Shape() {} };  class Point : public Shape {     int x, y; public:     Point(int x, int y) : x(x), y(y) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Point at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y &lt;&lt; \u00ab)\\\\n\u00bb;     }     std::string name() const override { return \u00abPoint\u00bb; } };  class Circle : public Shape {     int x, y, r; public:     Circle(int x, int y, int r) : x(x), y(y), r(r) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Circle at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y &lt;&lt; \u00ab), r = \u00ab &lt;&lt; r &lt;&lt; \u00ab\\\\n\u00bb;     }     std::string name() const override { return \u00abCircle\u00bb; } };  class Rectangle : public Shape {     int x, y, w, h; public:     Rectangle(int x, int y, int w, int h) : x(x), y(y), w(w), h(h) {}     void draw() const override {         std::cout &lt;&lt; \u00abDrawing Rectangle at (\u00ab &lt;&lt; x &lt;&lt; \u00ab, \u00ab &lt;&lt; y                   &lt;&lt; \u00ab), \u00ab &lt;&lt; w &lt;&lt; \u00abx\u00bb &lt;&lt; h &lt;&lt; \u00ab\\\\n\u00bb;     }     std::string name() const override { return \u00abRectangle\u00bb; } };  class Canvas {     std::vector&lt;Shape*&gt; shapes; public:     void add(Shape* s) { shapes.push_back(s); }     void render() const {         for (auto s : shapes) s-&gt;draw();     }     ~Canvas() {         for (auto s : shapes) delete s;     } };  int main() {     Canvas canvas;     canvas.add(new Point(1, 1));     canvas.add(new Circle(5, 5, 3));     canvas.add(new Rectangle(0, 0, 6, 3));      canvas.render();     return 0; }<\/code><\/pre>\n<h3>\u0422\u0435\u043f\u0435\u0440\u044c \u2014 \u0432\u044b.<\/h3>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0438 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u043d\u0435\u0440\u0435 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e\u0439, \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0441\u043a\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u0411\u0435\u0437 \u043c\u0430\u0433\u0438\u0438. \u0422\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/p>\n<\/li>\n<\/ul>\n<h3>\u042d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u043e.<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0432 \u043f\u0443\u0442\u0438. \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f. \u041a\u0430\u043d\u0432\u0430\u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0441\u044f. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u044f\u0432\u0438\u0442 \u0441\u0435\u0431\u044f.<\/p>\n<p>\u0410 \u043c\u044b, \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u2014 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0434\u0451\u043c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441:<br \/> \u00abTo OOP or not to OOP \u2014 \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u0430\u201d.<\/p>\n<h3>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438:<\/h3>\n<p><a href=\"https:\/\/github.com\/Kahelman\/habr-oop-battle\" rel=\"noopener noreferrer nofollow\">\u041e\u041e\u041f \u0411\u0430\u0442\u0442\u043b \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/909368\/\"> https:\/\/habr.com\/ru\/articles\/909368\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-459682","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=459682"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459682\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}