We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
Hybrid approach: factories should return RefCountPtr
Hybrid approach: factories should return RefCountPtr
Refactor #2519 [Rejected]
Status: | Rejected | |
---|---|---|
Start date: | 2013-08-10 | |
Priority: | High | |
Due date: | ||
Assignee: | - | |
% Done: | 0% |
|
Category: | - | |
Target version: | - |
All factory methods must return
RefCountPtr
objects instead of raw pointers.“Factory methods” means methods that return new objects or copies of other objects.
As an example:
All the
static
methods that start withcreate
clone
methods// Classes should look similar to this one:
class Sprite : public Node
{
public:
typedef RefCountPtr Ptr;
...
{
auto instance = new Sprite;
instance->initXXX();
return Ptr( instance );
}
}