当前位置:网站首页>Classification and extension of OC
Classification and extension of OC
2022-07-03 22:21:00 【Star Moon 0】
1. classification
That is to say .h And then there is .m file
The role of classification :
- Declare private methods ( Written in .m In file )
- Decomposing huge class files
- hold frame The private method of
Characteristics of classification :
- Runtime resolution
- You can add categories to system classes
What can be added to the classification :
- Example method
- Class method
- agreement
- Instance attributes ( Compiler will not build set,get Methods and member properties . It can be used runtime To implement by yourself set,get Method )
Source analysis shows that :
- The method added by the classification can override the method of the original class
- It depends on the compilation order : Finally, the method in the compiled classification will take effect
- Classification with the same name will cause compilation error
2. Expand
Only .h file
The role of expansion :
- Declare private properties
- Declare private methods
- Declare private member variables
The characteristics of expansion :
- Compilation is a resolution
- Only the form of declaration exists , Most of the time, they are parasitic on the host class .m in
- Cannot add extension for system class
My related blog :
iOS oc classification (Category)
ios oc Classify with related objects ( agreement ) Add attribute ( Associated references : Associative References)
iOS oc Expand (Extension)
Reference blog :
OC Categories ( classification ) And expand
OC classification Category
边栏推荐
- Development trend and market demand analysis report of China's energy storage battery industry Ⓩ 2022 ~ 2028
- 2022 safety officer-a certificate registration examination and summary of safety officer-a certificate examination
- DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
- How PHP adds two numbers
- Leetcode: a single element in an ordered array
- js demo 計算本年度還剩下多少天
- LeetCode 540. A single element in an ordered array
- Label coco format data and format data in the upper left corner and lower right corner are mutually converted
- On my first day at work, this API timeout optimization put me down!
- DR-AP40X9-A-Qualcomm-IPQ-4019-IPQ-4029-5G-4G-LTE-aluminum-body-dual-band-wifi-router-2.4GHZ-5GHz-QSD
猜你喜欢
![[golang] leetcode intermediate - alphabetic combination of island number and phone number](/img/40/a664ea866ce355c1f5e9305fe91780.jpg)
[golang] leetcode intermediate - alphabetic combination of island number and phone number

Bluebridge cup Guoxin Changtian single chip microcomputer -- hardware environment (I)

Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)

Team collaborative combat penetration tool CS artifact cobalt strike

On my first day at work, this API timeout optimization put me down!

Quick one click batch adding video text watermark and modifying video size simple tutorial

Some 5000+ likes, the development notes of a director of cosmic factory, leaked

Buuctf, misc: sniffed traffic

Introduction to kubernetes

How the computer flushes the local DNS cache
随机推荐
Blue Bridge Cup Guoxin Changtian MCU -- program download (III)
Code in keil5 -- use the code formatting tool astyle (plug-in)
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
Exness: the Central Bank of England will raise interest rates again in March, and inflation is coming
Asynchronous artifact: implementation principle and usage scenario of completable future
Investment analysis and prospect trend prediction report of China's boron nitride industry Ⓨ 2022 ~ 2028
Introduction to kubernetes
Quick one click batch adding video text watermark and modifying video size simple tutorial
LeetCode 1647. Minimum deletion times of unique character frequency
How to switch between dual graphics cards of notebook computer
Investment planning analysis and prospect prediction report of China's satellite application industry during the 14th five year plan Ⓑ 2022 ~ 2028
Functions and differences between static and Const
Plug - in Oil Monkey
Pat grade A - 1164 good in C (20 points)
JS demo calculate how many days are left in this year
[sg function] 2021 Niuke winter vacation training camp 6 h. winter messenger 2
WiFi 2.4g/5g/6g channel distribution
[template summary] - binary search tree BST - Basics
DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
Base ring tree Cartesian tree