How to return an instance of a class in Objective C? -
How to return an instance of a class in Objective C? -
i'm trying homecoming instance of class in function, i'm not sure how it.
i have class called generatemoves, , instance of class created:
generatemoves *move = [[generatemoves alloc] init]; i have class has utilize variables set in instance of class ("move", above).
so created function:
-(class)returnclass { homecoming move; } and in other class:
generatemoves *move = [otherclass returnclass]; however, throws warning saying incompatible pointer type.
how do this?
thanks assistance! :d
you want this:
-(generatemoves*)returnclass { homecoming move; } although phone call returnmove, rather returnclass
edit: bit more detail.
while way of writing things valid objective c, think it's easier understand if write this:
generatemoves* move = [[generatemoves alloc] init]; in other words, you're creating pointer generatemoves instance , assigning variable move. follows naturally homecoming type of returnclass generatemoves* (again pointer generatemoves instance)
objective-c class ios4
Comments
Post a Comment