Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between categories,subclasses and notifications,delegations [closed]

Tags:

objective-c

I am confusing from these areas.I searched on net.But every site giving different solutions.And i am new for this technology.So please provide corrects differences and definitions for this list.

like image 858
Naresh Venkat Avatar asked Nov 28 '22 17:11

Naresh Venkat


1 Answers

Categories vs. Subclasses

Categories let you expand the API of existing classes without changing their type. Subclassing also expands the API but introduces a new type. Additionally, subclassing lets you add state.

Notifications vs. Delegation

Notifications are a way to let unrelated classes communicate. Delegation on the other hand lets related classes communicate using a more explicitly defined interface.

like image 122
Nikolai Ruhe Avatar answered Dec 14 '22 23:12

Nikolai Ruhe