Projects > cpp > Issues > Refactor #2149

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

Create Issue on Github

Adding const qualification to some CCNode's getters

Refactor #2149 [Closed]
dumganhar 2013-05-13 07:04 . Updated over 3 years ago

Refers to https://github.com/cocos2d/cocos2d-x/pull/2539.

As we want to be able to copy construct CCNode's subclasses we want to be able to do this:

class SubNode : public cocos2d::CCNode
{
public:
    SubNode(const SubNode& other)
    {
        this->setContentSize(other.getContentSize());
    }
};
So i've added constness to the following getters:

getTag()
getContentSize()
getChildrenCount()
Of course this are not the only methods that need const added, but seem the most obvious ones.
We cannot add const to all of them because implementations of them would need to be const as well.
dumganhar 2013-05-13 08:16
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:381caa81689747a06634729cd06dc700c04ab934.

Atom PDF

Status:Closed
Start date:2013-05-13
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

100%

Category:all
Target version:2.1.4

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.