Can one overload a constructor with a private constructor with the same parameters?
Basically if something stores a positive integer, then in the public constructor it would make sure a positive integer was being stored, whereas in a private constructor it doesn’t perform the check.
Obviously this example isn’t really an appropriate use, but sometimes you want to create an object inside a method and you don’t want it to waste time performing full safe initialisation; you may want to just tell it to create something straight away without the special checks (or more prudently heap allocations or something expensive) when you’re going to perform them again later or they’re just unnecessary, and a method inside the class should be able to use this constructor automatically instead of the other public one with the same parameters.
You cannot overload on acccess like private versus public, but you can overload on the signature: the number of arguments and their types.
Private constructors are quite common.
One usage is for a logically “deleted” constructor (finally directly supported by C++11), and another is for use by a public factory function.
Example: