In most programming languages I've worked with, you can't have an class that contains and instance of it's own class. Naturally, you'd get compiler errors. But as I'm reading through Obj-C literature, I'm wondering if the use of pointers makes it possible. For instance;
Or, if I did it using dynamic typing;
Could I then have containedObject point to another object of the same class, or would this produce errors during runtime?
Code:
@interface myObject : NSObject {
myObject *containedObject;
}
Or, if I did it using dynamic typing;
Code:
@interface myObject : NSObject {
id containedObject;
}
Could I then have containedObject point to another object of the same class, or would this produce errors during runtime?