C++ 03 —— this
来源:互联网 发布:新蒙迪欧数据 编辑:程序博客网 时间:2024/06/08 15:52
源码
// 03This.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int j;public: void SetI(int ai) { cout << "this is :" << this << endl; this->i = ai;// 这句话等价于 i = ai; }};int main(int argc, char* argv[]){ Test t1, t2; cout << "t1 addr is :" << &t1 << endl; t1.SetI(1); cout << "t2 addr is :" << &t2 << endl; t2.SetI(1); //结论:class的member function内部,默认有一个this指针,指向调用者对象 //问题:所有的member function都含有this指针吗? return 0;}
问题:所有的member function都含有this指针吗?
静态成员函数没有this指针
阅读全文
0 0
- c++——this指针
- C/C++——this指针
- C/C++ 基础——this指针
- C++ 03 —— this
- 【C++】学习笔记四十八——this指针
- 【C/C++】this指针
- hdu——2115——C - I Love This Game( 比赛)
- Effective C++——》条款10:令operator=返回一个reference to *this
- C++——类实例化内存的分配和this指针的使用
- C++——类实例化内存的分配和this指针的使用
- 【C++】this 指针
- C++this指针
- C++this指针
- C++this指针
- C++this指针
- C++this指针
- c++this指针
- C++this指针
- iOS ARC 和 MRC 混合开发(注意事项)
- main函数参数列表
- Effective Java 学习笔记之泛型
- 最新wingide6破解方法(支持Linux),亲测有效,支持python3.0
- Storm(一) :基础知识
- C++ 03 —— this
- 触发器
- 离散上级题目5(求全集)
- 【Leetcode】67. Add Binary
- java语言基础(62)——BigDecimal类的使用
- Android 硬件访问服务
- Java设计模式——建造模式(Builder Pattern)
- 离散题目6(求补集)
- 浅析张量分解(Tensor Decomposition)