What are all the difference between categories and subclasses in iOS operating system?



What are all the difference between categories and subclasses in iOS operating system?..

Answer / Asad Ali

Categories and Subclasses are two ways to extend or modify the behavior of existing classes in iOS. The main differences are as follows:
1. Subclass: A subclass is a new class that inherits properties and methods from an existing class, and can override those methods. It creates a new entity with its own identity.
2. Category: A category adds methods to an existing class without creating a new subclass. It doesn't create a new entity but extends the functionality of an existing class. Methods added through categories are compiled into the same binary as the original class, but they don't have their own instance variables.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Interview Questions

Can I have relationship between entities in separate stores (in case of configurations)?

1 Answers  


What are the differences between categories and extensions?

1 Answers  


How to register as a iphone developer?

1 Answers  


Define ipa?

1 Answers  


Do you know what is iphone reference library?

1 Answers  


How to run xcode and other tools with the iphone sdk?

1 Answers  


What is didreceivememorywarning method in you viewcontroller?

1 Answers  


Explain commonly ios libraries

1 Answers  


Explain parent-child context setup. What are the advantages?

1 Answers  


Explain the different types of ios application states.

1 Answers  


Explain the usage of struct?

1 Answers  


What are ibeacons?

1 Answers  


Categories