Projects > cpp > Issues > Refactor #3480

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

Create Issue on Github

Removes unneeded codes of override function.

Refactor #3480 [Closed]
dumganhar 2013-12-23 11:41 . Updated over 11 years ago

Node has virtual methods:

virtual void addChild(Node* child, int zorder, int tag);
virtual void addChild(Node* child, int zorder);
virtual void addChild(Node* child)

Sprite only override addChild(Node* child, int zorder, int tag),

OLD:

Sprite should also override all these three methods.

NEW

By using using Node::addChild, at the header of Sprite. Another two override functions will be not needed.

TO SUPPORT `NEW ` , Bindings-generator also needs to be updated.

It should not bind override methods, since cpp has the feature of polymorphism.
In this way, it will reduce some memory cost in JS/LUA vm.

The changes of Bindings-generator is here: https://github.com/cocos2d/bindings-generator/pull/62
The patch for Cocos2d-x is here: https://github.com/cocos2d/cocos2d-x/pull/4600

Our codes will be clearer after applying this patch. Cheers.

dumganhar 2013-12-23 11:41
  • Tracker changed from Bug to Refactor
dumganhar 2013-12-23 11:42
  • Description updated (diff)
dumganhar 2013-12-24 05:57
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:5746e673c48804a9544de30be5ed911b1473e067.

Atom PDF

Status:Closed
Start date:2013-12-23
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

100%

Category:all
Target version:3.0-beta