Projects > cpp > Issues > Refactor #2519

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Hybrid approach: factories should return RefCountPtr

Refactor #2519 [Rejected]
ricardo 2013-08-10 00:35 . Updated over 11 years ago

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 with create

    • All the clone methods

    // Classes should look similar to this one:
    class Sprite : public Node
    {
    public:
    typedef RefCountPtr Ptr;

    ...

    static Ptr createXXX() 
    

    {
    auto instance = new Sprite;
    instance->initXXX();
    return Ptr( instance );
    }
    }

ricardo 2013-08-10 00:38
  • Priority changed from Normal to High
ricardo 2013-08-13 03:21
  • Status changed from New to Rejected

Rejected:
Hybrid approach won’t be done.

Atom PDF

Status:Rejected
Start date:2013-08-10
Priority:High
Due date:
Assignee:-
% Done:

0%

Category:-
Target version:-