Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To answer your question: "if i import a class.h file which has same class variable like my class file ,then is it conflict with my class variable, or what will happen??"</p> <p>No there will not be a conflict. When you define instance variables in a class, it is for objects of that class type only. For example, if you have Class1 which has a property <code>UIColor *color</code> and Class2 has a property <code>UIColor *color</code>, and you include the Class2.h file in class1.m, then you do something like <code>color = [UIColor blueColor];</code> in a method inside Class1.m you will be referring to class1's color property. To refer to the color property of class2, you would have to instantiate a class2 object and then set it's property like so:</p> <pre><code>Class2 *c2 = [[Class2 alloc] init]; c2.color = [UIColor greenColor]; </code></pre> <p>Hope that helps a little.</p> <hr> <p>Also, as others have mentioned, you should really just have one game class and either create new instances of the same class or just change the properties of the existing instance. If the 5 classes are very similar, but just harder, you should just have a difficulty property, and then use new instances of the same class with that property set to a higher value.</p> <p>And, to clear any confusion, let's say you have Class1 again and it's a view controller. You can, inside a method in Class1, create a new Class1 object and display it and it will be a new instance of Class1, with whatever different properties you set.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload