Dear all,
I want to count objects in CCArray but getting error (Access Violation) as in image.
I’m using visual studio express 2012 and windows 8.
This is my .h file:
class Item : public cocos2d::CCLayer
{
public:
————————
cocos2d::CCArray *items;
————————
}
.cpp file:
bool Item::init()
{
————————-
items = CCArray::create();
items~~>retain;
————————~~
for(int i = 1; i <= 6; j++){
items~~>addObject;
}
————————~~
}
int Item::countItems()
{
return items~~>count;
}
I call the countItems from other file:
——————
Item p;
int itemsCount = p.countItems;
——————
Error occured in item~~>count() in count method.
Please Help!
Untitled.png (9.2 KB)