katyscode.wordpress.com
C++: Polymorphic cloning and the CRTP (Curiously Recurring Template Pattern)
A common problem in C++ occurs when you have an object of an unknown derived type and want to make a copy of it. Consider the following code: You can’t just use new Vehicle in this situation …