So I have this class called a Cell which is a subclass of CCSprite then I have three other subclasses of Cell.
In one of the subclasses I am overriding a method called addCellToCell in class Cell:
-(void)addCellToCell:(id)_cell;
And I am trying to do this:
self = [CCSprite spriteWithFile:@"Jet.png"];
[self setPosition:ccp(_cell.position.x+5, _cell.position.y)];
Where I am trying to set the object self‘s position (which since it is inheriting from Cell it makes it essentially a modified CCSprite) relative to another Cell subclassed object (potentially from any one of the three subclasses).
But when I do this I get the error:
request for member ‘position’ in ‘_cell’, which is of non-class type ‘objc_object*’
It also suggest I use “->” instead of “.” so I change it to that:
‘struct objc_object’ has no member
named ‘position’
Sorry if it is confusing… Please ask for any clarification if you need some. How can I fix these errors?
Definition of Cell class:
@interface Cell : CCSprite {
}
-(void)addToCell:(id)_cell;
@end
Cast it to
Cellobject before using it,and then