When to use class constructor Vs. Create() method

Could someone explain which situations it is better to use the constructor vs. a Create() method? I always see code that uses different methods to achieve the same thing, like this:

Class::Window MyWindow("Hello");

or

Class::Window* MyWindow = Class:Window::Create("Hello");
The first one is just your regular object creation.

The second one is a kind of object factory you may see when dealing with runtime polymorphic class hierarchies: this one might have created a Class::HelloWindow, derived from Class::Window and returned a pointer to it, cast to pointer to base.
Topic archived. No new replies allowed.