I already failed this interview but hopefully I could learn my mistakes from you guys. the question went like this.
which of the following can be achieved with 'category' and 'extension'?
1. add polymorphism to any existing classes in a platform SDK, e.g. NSString
2. add addition instance variables to existing classes in a platform SKD, e.g.NSString
3. use as a type for declaring variables
4. add additional methods to existing classes in a platform SDK, e.g.NSString
In my understanding,
category
=> add more functionality (new method, not property) to class without inheritance, doesn't own the class
extension
=> deals with property, owns class
so then intersection of category
and extension
should be number 3? Did I get it right? someone please shine the light on this.