adspace


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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain parent-child context setup. How does it work? What are the advantages?

875


What is latest ios version?

1003


What is dependency management tools?

877


Why do all model object attributes get marked with @dynamic and not synthesised?

976


What is the purpose of reuseidentifier?

920


How to handle concurrency problems in core data?

1017


What is nsmanagedobjectcontext? What are the different concurrency types? Explain them.

832


What is latest xcode version?

920


What are transient properties?

925


What's the latest version of ios?

977


Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?

850


What are the different store migration options? How do they work?

879


In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file?

991


What is latest version of ios?

867