当前位置:网站首页>【类的本质(Objective-C语言中)】
【类的本质(Objective-C语言中)】
2022-07-28 02:32:00 【清风清晨】
前言
在Objective-C语言中,类的本质是什么?
一、内存的五大区域是什么?
1.栈——存储局部变量
2.堆——存储程序员用malloc,realloc,calloc自己申请的空间,以及类的对象。
3.BSS段——存储未初始化的全局变量,静态变量
4.数据段(常量区)——存储已经初始化的全局变量,静态变量。
5.代码段——存储类的二进制代码,方法的二进制代码
二、类的本质
1.类什么时候被加载到代码段?
类第一次被访问的时候,被加载到代码段,称为“类加载”。
2.类一旦被加载到代码段以后,什么时候回收?
程序结束时回收。
3.类以什么样的形式存储在代码段?
1)前言:任何存储在内存当中的数据,都有一个数据类型。
2)前言:任何在内存中申请的空间,也有自己的类型。
3)在代码段中存储类的空间是什么类型的:Class类型的
4)在代码段中存储类的步骤:
a. 现在代码段中创建一个Class对象。
b. Class是Foundation框架中的一个类,那Class对象是干嘛的呢,是用来存储类的。
c. 将类的信息存储在这个Class对象之中
d. 这个Class对象至少应该有三个属性:
- ClassName 存储类名
- 存储类的属性们
- 存储类的方法们
e. 记住,这是个对象,所以里面有一个iSA指针,这个指针指向这个类的父类。
总结
这篇文章讲述了类的本质,之后会加上怎么拿到这个类对象,以及如何通过类对象调用类方法。
边栏推荐
- ECCV 2022 | open source for generative knowledge distillation of classification, detection and segmentation
- Web服务器
- Docker advanced -redis cluster configuration in docker container
- Ci/cd from hardware programming to software platform
- style=“width: ___“ VS width=“___“
- 43.js -- scope chain
- Pytorch 相关-梯度回传
- 数据湖:各模块组件
- 注意,这些地区不能参加7月NPDP考试
- Record of a cross domain problem
猜你喜欢

Stop paging with offset and limit. The performance is too poor!

Es6.--promise, task queue and event cycle

Promise object

Intelligent industrial design software company Tianfu C round financing of hundreds of millions of yuan

Development and design logic of rtsp/onvif protocol easynvr video platform one click upgrade scheme

蓝桥杯原题

嵌入式分享合集22
[email protected]注解使用"/>[email protected]注解使用

Interview experience: first tier cities move bricks and face software testing posts. 5000 is enough

Decision tree and random forest learning notes (1)
随机推荐
Which of the four solutions of distributed session do you think is the best?
The applet has obtained the total records and user locations in the database collection. How to use aggregate.geonear to arrange the longitude and latitude from near to far?
Niuke-top101-bm340
一次跨域问题的记录
vscode debug显示多列数据
JS event object offsetx/y clientx y pagex y
Intelligent industrial design software company Tianfu C round financing of hundreds of millions of yuan
Gbase8s how to delete data in a table with a foreign key relationship
QT topic 1: implementing a simple calculator
基于c8t6芯片开发RC522模块实现呼吸灯
Oracle basicfile lob field space recycling shrink space doubts
【uni-app高级实战】手把手带你学习一个纯实战复杂项目的开发2/100
QT专题1:实现一个简易计算器
style=“width: ___“ VS width=“___“
What "posture" does JD cloud have to promote industrial digitalization to climb to a "new level"?
Kubernetes -- Introduction
Web server
【AcWing 327. 玉米田】状压dp
ECCV 2022 | open source for generative knowledge distillation of classification, detection and segmentation
Superparameter adjustment and experiment - training depth neural network | pytorch series (26)