iphone - How to set up a has-many relationship in Cocoa? -


I am creating a (very) simple FTP app in Cocoa, and to store information on different types of servers Therefore, I have created a ServerType class, which stores all the relevant information about a single type of server, which is supported. I then have a ServerTypes class that is designed to manage all server type classes.

My question is how to set the relationship between two objects What is the preferred way to do this?
Also, since the purpose does not support non-frequency classes, where should I make an example of the server type that must be used throughout the program? Or is there a better way to do this? I need this to suit the KVC so that I can tie a NSPopupBox one of the server type properties.

Sorry about the large number of questions, I am quite new in cocoa and purpose. If you need to see the code, just ask and I will be happy to add something. :) - SphereCat1

To manage relationships between 2 objects, you have 2 ways Are: Composition or Legacy

You can inherit a class to create subclasses, then you will have relationships.

If one object contains another as a frequency variable then you have a relationship.

Here, I think it would be best to use the structure, where server type objects are the array of all server type objects. The objective-supports non-frequency variables (if you mean it) by creating stable variables. Then you can use it throughout the program


Comments