Prototype (C++ tutorial) - Design Patterns

preview_player
Показать описание
Creating a lot of marginally different objects can be costly, both in terms of runtime performance and productivity. Let me show you a pattern which solves that problem.
Рекомендации по теме
Комментарии
Автор

This is the first time ever I saw you using the "class" keyword. :)

gauravarya
Автор

hi and thanks for the share. One thing I don't understand : what's the point of this pattern in C++ over copy constructor ? in reference based languages that don't have copy constructor like java or c#, among others, ok I understand, but for C++, I don't really get it.
coz in the end, we have to implement the clone method in that pattern just as we would have to reimplement the copy constructor.

yannickcotten
Автор

But here your using Shallow Copy .

Changing the color in any car changes the color of all other clones including the prototype.

alexbarbaary
Автор

One of the patterns I do not like... Thank you for the video and for mentioning expensive c-tor.

nmmm
Автор

useful but why don't you use "using namespace std;" ?

rahimwardak
Автор

EXC_BAD_INSTRUCTION after doing this code :/

rolanabbasguliev
welcome to shbcf.ru