The first is because you're trying to create ApiRequest
using a private constructor from another class, ApiRequestPrivate
. Presumably, the constructor wants to be private to support whatever singleton-based insanity you think you want; so one solution is to make ApiRequestPrivate
a friend of ApiRequest
.
Alternatively, you could create the object in ApiRequest::getApiRequest
. There's no point moving the implementation of that function into the private class.
The second is because the function is static, so there is no object to access the members of. However, the function you're calling is also static, so you don't need the object anyway:
return ApiRequestPrivate::getApiRequest(value);
But, again, there's really no point introducing that extra function.
I'm also wondering what's supposed to happen if you want to pass one value to the function to create the request, and then pass a different value the next time. If that needs to change, then a singleton is probably an even worse idea than it usually is.