i declared a method inside AppDelegate Class in xcode , these method uses variables declared in another class inside the project .
when i run and build the project all the variables made an errors which are
“request for member ‘xArray’ in something not a structure or union”
and
” ‘y’ undeclared “
i added #import statements, but the problem is still existing.
any help ?
Thanks in advance .
You can’t access variables declared inside a class unless you have a pointer to an instance of that class, a.k.a. an object. There might be a dozen instances of that class, each with its own copies of the instance variables — how else can you know which object’s variables to access?
Beyond that, one of the big features of the object oriented style is the ability to encapsulate variables inside an object, and to restrict outside access to them. It’s not a good idea to access some other object’s ivars. Instead, use property accessor methods to get the public versions of those values.