Hi all,
I'm a beginner programmer with Cocoa, but I've programmed on Windows for a while. What I'd like to do is the following; I've created some simple classes, with each representing a 'profession' i.e.
1. Fireman - {name,age, salary| getName, getAge, getSalary etc...}
2. Policeman - {name, Rank, Dept}| getName, getRank, getDept etc...}
The classes contain different 'attributes' for each profession, and getter/setter methods for these attributes.
I'd like to have an array (or whatever is appropriate) of these objects, and use bindings to tie the array to the UI. The problem is that all these objects are not of the same type.
From what I've read, I think these are my choices:
1. Have an NSArray of NSDictionary, using the NSDictionaries to store the attributes instead of creating objects.
2. Create an NSDictionary and add these different objects. If this is an option, how would I determine the object type would I have to do something different for the bindings?
3. Have one 'controller'class, that would manage different arrays of objects i.e. One Array of Firemen, another array of Policemen etc
I can do this easily enough when all the objects are of the same type, but I'm not sure how to handle the different Object types.
Thanks for any information/thoughts you might have,
regards,
Brendan.
I'm a beginner programmer with Cocoa, but I've programmed on Windows for a while. What I'd like to do is the following; I've created some simple classes, with each representing a 'profession' i.e.
1. Fireman - {name,age, salary| getName, getAge, getSalary etc...}
2. Policeman - {name, Rank, Dept}| getName, getRank, getDept etc...}
The classes contain different 'attributes' for each profession, and getter/setter methods for these attributes.
I'd like to have an array (or whatever is appropriate) of these objects, and use bindings to tie the array to the UI. The problem is that all these objects are not of the same type.
From what I've read, I think these are my choices:
1. Have an NSArray of NSDictionary, using the NSDictionaries to store the attributes instead of creating objects.
2. Create an NSDictionary and add these different objects. If this is an option, how would I determine the object type would I have to do something different for the bindings?
3. Have one 'controller'class, that would manage different arrays of objects i.e. One Array of Firemen, another array of Policemen etc
I can do this easily enough when all the objects are of the same type, but I'm not sure how to handle the different Object types.
Thanks for any information/thoughts you might have,
regards,
Brendan.