So I have an object that can be constructed in a few ways. The constructors have signatures like, the one that loads an object from a file:
Object::Object( string filenameToLoadFrom ) ;
And how it behaves is pretty straightforward.
Object( "filename.dat" ) ; // loads object from filename
The constructor signature pretty much says what it does, although a static method Load
might arguably be better:
static Object* Object::Load( string filenameToLoadFrom ) ;
(syntax above is slightly incorrect but you get the idea.)
Then we come into cases where what the constructor does isn't immediately obvious from the parameters. a name is needed to make it clear from the API what the constructor does.
The question is, is it a good idea to write static methods that return an instance of the object, just for the sake of being able to name the constructor?