We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
Constructors should be protected, but should be a way to disable them
Constructors should be protected, but should be a way to disable them
Bug #3897 [Closed]
- Target version changed from Candidate to 116
Already be done in v3.0.
Good feature, especially for script bindings.
- Target version changed from 116 to 3.0-beta2
Status: | Closed | |
---|---|---|
Start date: | 2014-02-05 | |
Priority: | Normal | |
Due date: | ||
Assignee: | - | |
% Done: | 100% |
|
Category: | all | |
Target version: | 3.0-beta2 |
For more info:
http://www.cocos2d-x.org/forums/6/topics/34011?r=44278#message-44278
Basically, we moved many constructors to
protected
. That is good, since it will prevent many memory leaks.But advanced users my still want to create objects manually, or even create objects in the "stack".
And we should support those use cases.
So, a user suggested to do the following:
I think it adds little overhead, and advanced users will be happy with this compile-time feature.