当前位置:网站首页>关于this指针
关于this指针
2022-07-23 06:35:00 【c.Coder】
this指针的功能:即在非静态成员函数调用时,可以更准确的访问到实例化对象中的成员属性this指针的类型:类的类型* const,const直接修饰指针本身,即this指针本身的指向不能被改变非静态成员函数不具备该隐藏参数(this指针),因为静态成员函数并不具体属于哪个对象,故其没有指向某个对象的this指针this指针本质上是非静态成员函数的第一个形参(被隐藏的),当对象调用成员函数时,才将对象地址作为实参传递给“this”形参,所以对象中并不存储this指针。
ps:一般情况下(在vs环境下)是由编译器通过ecx寄存器自动传递,无需用户传递
由于this指针是作为实参传递的,所以this指针都是存储在栈空间中。
当非静态成员函数被调用时,如果函数内部并不涉及到对象内的具体成员属性则this指针可以为空,即“this = nullptr”
边栏推荐
- MetaApp开发面试题目
- 第九天笔记
- Point target simulation of SAR imaging (III) -- Analysis of simulation results
- The relationship between method area, perpetual generation and meta space
- 射击 第 1-3 课:图像精灵
- Metaapp development interview questions
- Problem solving: script file 'scripts\pip script py‘ is not present.
- 太空射击 Part 1: 玩家精灵和控制
- 行业现状令人失望,工作之后我又回到UC伯克利读博了
- Beifu PLC and C transmit int type variables through ads communication
猜你喜欢

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value:

Point target simulation of SAR imaging (II) -- matlab simulation

深入解读 EVM 的生态帝国

com.mysql.cj.jdbc.exceptions. MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value:

The principle of Google interview questions is to analyze 12 table tennis balls, one of which is defective. Weigh it with a balance for 3 times to find it

"Computing beast" Inspur nf5468a5 GPU server open trial free application

Don't be silly to distinguish these kinds of storage volumes of kubernetes

EasyGBS平臺出現錄像無法播放並存在RTMP重複推流現象,是什麼原因?
![[jzof] 07 rebuild binary tree](/img/c8/5b67a3921afda5323b0d1eea6a78bc.png)
[jzof] 07 rebuild binary tree

Day 10 notes
随机推荐
Smart city infrastructure management based on bim+3dgis
Space shooting part 2-2: enemy spirit
倍福PLC和C#通过ADS通信传输String数组类型变量
Shooting lesson 1-3: image Sprite
-XX:+UseCGroupMemoryLimitForHeap 无法创建虚拟机问题
Introduction to radar part vii 1 radar and resolution
【 Visual Dispatching Software】 Shanghai Dow Ning apporte netronic download, Trial, tutoriel pour l'Organisation SMB
UI automation
keepalived双机热备
Method of entering mathematical formula into mark down document
第九天笔记
Beifu PLC -- C ads communication reads variables in the form of notification
Day 8 notes
"Computing beast" Inspur nf5468a5 GPU server open trial free application
分类模型的评估
【日常训练】814. 二叉树剪枝
机器学习,吴恩达逻辑回归
Are there any academic requirements for career transfer software testing? Is there really no way out below junior college?
Beifu PLC and C transmit bool array variables through ads communication
Day 12 notes