Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a constructor function with multiple enum states for a card game?
    primarykey
    data
    text
    <p>I am trying to code a custom object where I want multiple letters associated or tagged to it.</p> <p>I'm trying to code a similar setup where an Object can have multiple letters (or booelan flags) assigned to it.</p> <p>For example, <code>Company</code> might have the letters "A,B,C,F" (out of letters A through F).</p> <p>I'd like to create an <code>Company</code> card and assign it certain letters in a constructor method.</p> <p>At first I thought I'd use an array -- but I'd like to keep the letters seperate as the letters are really just a big matrix of "boolean" flags.</p> <pre><code>IE: Letters A B C D E F "Brand X" Y Y N N Y N </code></pre> <p>My code as follows;</p> <pre><code>typedef enum _Letters { LetterA, LetterB, LetterC, LetterD, LetterE, LetterF, } Letters; @interface Corporation : NSObject { NSString *_name; // Name of the card ie: "Automative" NSArray *_letters; // A-&gt;F int _value; // Value of the card in $ VENCardState _state; // Current state of the card (is it in play or discard pile, etc) } </code></pre> <p>What I'd like but am sure about is how to make <code>letters</code> contain all the letters I want in an init constructor function.</p> <p>ie;</p> <p><code>initWithLetters:A,B,C....</code></p> <p>But am unsure of how to do this. </p> <p>Basically I want a simple way of making a constructor that will have multiple enum states and then the method will add these enum states into an array of <code>letters</code></p> <p>I should be able to log the object and discover what letters it is associated with.</p>
    singulars
    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.
 

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