curiously recurring template pattern in C++
``` #include <iostream> using namespace std; template<typename specific_animal> struct animal { void who() { static_cast<specific_animal*>(this)->who(); } }; struct dog : animal<dog> { void who() { cout << "dog" << endl; } }; struct cat : animal<cat> { void who() { cout << "cat" << endl; } }; template<typename specific_animal> void who_am_i(animal<specific_animal> any) { any.who(); } int main() { cat c; who_am_i(c); // prints `cat` dog d; who_am_i(d); // prints `dog` } ```