How to create an abstra...
How to create an abstra...
In Objective-C, there is no direct equivalent to abstract classes as found in other object-oriented programming languages like Java or C#. However, you can achieve a similar concept by using protocols and class clusters.
Here's how you can create an abstract class-like structure in Objective-C:
@protocol AbstractClass
- (void)abstractMethod;
@property (nonatomic, copy) NSString *abstractProperty;
@end
@interface ConcreteClass : NSObject <AbstractClass>
@end
@implementation ConcreteClass
- (void)abstractMethod {
// Implement the abstract method
}
@synthesize abstractProperty;
@end
@interface AnotherClass : ConcreteClass
- (v...
senior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào