Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between category and extension in objective c?



What is the difference between category and extension in objective c?..

Answer / Sumit Sharma

Both categories and extensions allow developers to add new methods to existing classes without modifying their original source code. However, there are some differences:n1. Category: It can be applied to any class at runtime, even if the class was not originally designed for the category. Categories have a separate header file (extension) that defines the interface and implementation of the new methods. They can also share the same name with other categories or extensions.n2. Extension: It is only available in Objective-C 2.0 or later versions, and it can be applied to any class, protocol, or namespace during development. Extensions should be used for adding properties and methods to a class that was designed for them. They must have the same name as the original source file.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Objective-C Interview Questions

Who calls dealloc method? Can we implement dealloc in arc?

1 Answers  


What is protocol in simple words?

1 Answers  


What are the attributes of category?

1 Answers  


What does @synchronized() do?

1 Answers  


Does objective-c contain private strategies?

1 Answers  


What is the main difference between function calls and messages?

1 Answers  


How to call a function in objective-c?

1 Answers  


What is protocol with example?

1 Answers  


How to print string in objective c?

1 Answers  


What are the different types of protocols?

1 Answers  


Can you differentiate polymorphism from abstraction?

1 Answers  


What are nsautoreleasepool?

1 Answers  


Categories