cocos2d::CCArray *arr;
cocos2d::CCSprite *foo;
arr->addObject(foo);
CCObject *item;
CCARRAY_FOREACH(arr, item)
{
//how to get item->getPosition() ????
}
I know foo in arr is CCObject. And I want to know how to get their subclass’ member.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
also if you store similar objects, take a look to CCMutableArray. It is a template-based container that will return instances of provided to template type without need to cast