Talk:More C++ Idioms/Virtual Constructor

It's pointless to have a member function virtual Employee::Employee* create What the author probably wanted to do is polymorphic construction, aka factory pattern. In this case a non-member function gets some type flag and returns a newly created object typed as pointer to base.

Consequently the name "virtual constructor" is wrong, which is commonly understood as the factory pattern! Please rename this idiom here to "clone" instead and remove virtual member "create" from the example.

> I agree with you. "clone" pattern has been used widely in std::function or anywhere that requires some kind of type erasure, but virtual constructor "create", I think, is rarely used. --Htfy96 (discuss • contribs) 13:31, 3 February 2017 (UTC)