Can a class have a property and the class of the property is the class itself?
@interface testClass:NSObject
@property (nonatomic, strong) testClass *testProperty;
@end
@implementation testClass
@end
Can a class have a property and the class of the property is the class itself?
@interface testClass:NSObject
@property (nonatomic, strong) testClass *testProperty;
@end
@implementation testClass
@end
Yes it can have, this is called self-referencing class.
Why it is not a compiler issue ?
Because you create a pointer to the object of same type, not the object.
This is frequently seen in C / C++ data structures like Linked List.