在函数中使用实例变量

时间:2015-08-17 07:28:03

标签: objective-c c instance-variables

所以,这可能是一个非常简单的问题,如果它很明显,我现在要道歉,但我无法在任何地方找到答案。所以,在这里。假设我有一个班级:

@interface MyClass : NSObject

@property int Radius;
@property int Iterations;
@property UInt32 * Data;

@end

在我的实施文件中我有:

@interface MyClass()

void Foo(int * newData);

@end

@implementation MyClass

// Synthesize block
// Getter-Setter block

void Foo(int *newData) {
    // Do some stuff
    _Iterations++;                   // Use of undeclared identifier _Iterations
    Iterations++;                    // Use of undeclared identifier Iterations
    self.Iterations++;               // Use of undeclared identifier self
}

@end

有人可以解释为什么我有这个错误以及我应该如何修复它?

谢谢,

0 个答案:

没有答案