class V8_EXPORT Integer : public Number {
public:
static Local<Integer> New(Isolate* isolate, int32_t value);
static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
int64_t Value() const;
V8_INLINE static Integer* Cast(v8::Value* obj);
private:
Integer();
static void CheckCast(v8::Value* obj);
};
The above code is from Google V8. Initialization Example:
Handle<Value> x = Integer::New(42);
From what I see in the source code, they marked the constructor as private and want you to use the New function to instantiate this class. Isn't that against standard C ++ design patterns? Why didn't they just overload the constructor instead of creating static functions to create? This is usually what you see when people try to transfer the library from one language to another (the only thing I can remember from the top of my head right now is the Xamarin iOS suite).
I tried to use Google for the name for this type of agreement, but could not find anything on it.