Instance variable 'variable' accessed in class method error?

If you meant to make this an instance method, change that + to - (do the same in declaration).

If you meant to make this an instance method, change that + to - (do the same in declaration): - (void) hit { NSLog(@"hit"); _nPerfectSlides = 0; _game show }.

– Ahoura Ghotbi Nov 4 at 23:36 1 Create an instance of the class and call the instance method on that instance… – Arkku Nov 4 at 23:37 4 You seem not to have grasped the core concepts of OOP. Have you assimilated docs like this one? Otierney.Net/objective-c.

Html – Cyrille Nov 4 at 23:42 @Cyrille you are right, I am new to OOP tbh, used to structured coding. I am reading a few docs around the net and trying to figure it out and also shape up my OOP. But thanks anyways – Ahoura Ghotbi Nov 4 at 1:16.

An instance variable is, as its name suggests, only accessible in the instance methods (those declared with -). Class methods (declared with +) have no access to instance variable, no more than they have access to the self object.

– Ahoura Ghotbi Nov 4 at 23:37 I don't understand your comment. Either you change your + (void) hit into a - (void) hit, or you declare _nPerfectSlides on a global level, outside of your class' @interface. – Cyrille Nov 4 at 23:39 @Ahoura Ghotbi: use global variable just as Cyrille said.

– user523234 Nov 5 at 3:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions