It is a normal C++ pointer, so your question is a little strange. What exactly do you mean by it? Perhaps it’s best to brush up on C++ before diving into the Cocos2d-x code.
cocos2d::Ref is just a class, and
cocos2d::Ref* is a raw pointer to an object of type
Find the definition of the
cocos2d::Ref class, which would be a ‘go to reference’ or ‘go to declaration’ command in whichever IDE you’re using. You could also just use the search function in the IDE, and you would end up here in
CCRef.h, where you would see this comment in the code:
* Ref is used for reference count management. If a class inherits from Ref,
* then it is easy to be shared in different places.
* @js NA
class CC_DLL Ref
... rest of the class which a lot more comments
A quick Google search for
what is cocos2d::Ref would have sent you to the docs:
Aside from that, this may help you along (not specifically related to
Where you see
cocos2d::Ref* is most likely in event handlers or callbacks etc. In these cases you would need to cast that Ref pointer to the type you’re expecting, and check that it’s valid (unless you’re 100% certain it is).
void ClickHandler(cocos2d::Ref* sender)
auto button = dynamic_cast<cocos2d::ui::Button*>(sender);
if (button != nullptr)
// It's a valid button pointer...