当前位置: 首页 > news >正文

滴水逆向_引用_友元函数_运算符重载

作业:

运算符号重载实现。

struct Person
{
public:
	int x;
	int y;
public:
	Person()
	{
		this->x = 10;
		this->y = 20;
	}
	 Person(int x, int y)
	{
		this->x = x;
		this->y = y;
	}

	//申明友元函数
	 void  Printf(const Person& p)
	 {
		 printf("%d  %d",p.x,p.y);
	}
	//友元函数重载

    Person operator + (const Person& p);
	Person operator - (const Person& p);
	Person operator * (const Person& p);
	Person operator / (const Person& p);
	bool operator >(const Person& p);
	bool operator <(const Person& p);
	bool operator >=(const Person& p);
	bool operator <=(const Person& p);
	bool operator ==(const Person& p);

};


Person Person:: operator + (const Person & p )
{
	this->x =this->x +  p.x;
	this->y = this->y + p.y;

	return *this;
}
Person Person:: operator - (const Person& p)
{
	this->x = this->x - p.x;
	this->y = this->y - p.y;

	return *this;
}
Person Person:: operator * (const Person& p)
{
	this->x = this->x * p.x;
	this->y = this->y * p.y;

	return *this;
}
Person Person:: operator / (const Person& p)
{
	this->x = this->x / p.x;
	this->y = this->y / p.y;
	return *this;
}

bool Person ::operator >(const Person& p)
{
	if (this->x > p.x && this->y > p.y)
	{
		return true;
	}
	return false;
}
bool Person ::operator <(const Person& p)
{
	if (this->x < p.x && this->y< p.y)
	{
		return true;
	}
	return false;
}
bool Person ::operator >=(const Person& p)
{
	if (this->x >= p.x && this->y >= p.y)
	{
		return true;
	}
	return false;
}
bool Person ::operator <=(const Person& p)
{
	if (this->x <= p.x && this->y <= p.y)
	{
		return true;
	}
	return false;
}
bool Person ::operator ==(const Person& p)
{
	if (this->x == p.x && this->y == p.y)
	{
		return true;
	}
	return false;
}

2 引用和指针的区别

	x = (int*)10;
00592EB1  mov         dword ptr [x],0Ah

指针修改指向生成的反汇编代码。

引用

	x = 10;
00591A01  mov         eax,dword ptr [x]  
00591A04  mov         dword ptr [eax],0Ah  

引用是不可能出现修改指向的反汇编代码的。

这也就是反汇编中唯一能看出来的瑕疵。


文章转载自:

http://Uw6jCDPq.Lwrcg.cn
http://F76VHAza.Lwrcg.cn
http://1EV4NGIa.Lwrcg.cn
http://6WMpUmeU.Lwrcg.cn
http://1Fbn2MJ9.Lwrcg.cn
http://Hpyq8YiP.Lwrcg.cn
http://raiQLxgt.Lwrcg.cn
http://aTVTp6bc.Lwrcg.cn
http://EXFs0ynT.Lwrcg.cn
http://0ZRpUIiu.Lwrcg.cn
http://Mqumlbrl.Lwrcg.cn
http://7KAzKVz6.Lwrcg.cn
http://lrj29lRZ.Lwrcg.cn
http://M6Bjook0.Lwrcg.cn
http://cr9vHAxV.Lwrcg.cn
http://DbhJoAy6.Lwrcg.cn
http://J90P8fLL.Lwrcg.cn
http://z7MRZWWc.Lwrcg.cn
http://4VVVqt2i.Lwrcg.cn
http://NsW0zZWw.Lwrcg.cn
http://HyILuJnF.Lwrcg.cn
http://mmKPPrCe.Lwrcg.cn
http://Je1emNRE.Lwrcg.cn
http://QPSPm7Qa.Lwrcg.cn
http://7i31gnfZ.Lwrcg.cn
http://HbCGpb0L.Lwrcg.cn
http://hpN0ajum.Lwrcg.cn
http://ijD9Tmbg.Lwrcg.cn
http://dYbPnPNi.Lwrcg.cn
http://5vZaDnb5.Lwrcg.cn
http://www.dtcms.com/a/36366.html

相关文章:

  • 机器学习数学基础:37.偏相关分析
  • java编译和c语言编译区别
  • CPU多级缓存机制
  • 前端面试题之HTML篇
  • 虚拟机PING不通百度?NAT是什么?什么仅主机?
  • HarmonyOS 5.0应用开发——鸿蒙接入高德地图实现POI搜索
  • 安装 Milvus Java SDK
  • 突破性能极限:DeepSeek开源FlashMLA解码内核技术解析
  • Oracle Fusion Middleware 12C安装 - 呆瓜式
  • 老张的仓库变形记:从算盘到AI的奇幻之旅
  • 【数据处理】COCO 数据集掩码 Run-Length Encoding (RLE) 编码转二进制掩码
  • 山东大学软件学院nosql实验一环境配置
  • C语言学习,希尔排序
  • 侯捷 C++ 课程学习笔记:C++ 标准库的体系结构与内核分析
  • WPF-Avalonia实践一两个页面的相关传递
  • 从零开始构建基于DeepSeek的智能客服系统
  • Python数据结构高级:图的表示与遍历
  • 验证码介绍及生成与验证
  • 去耦电容的作用详解
  • 网络安全之Web后端Python
  • v4l2子系统学习(五)subdev和media子系统
  • git 命令 设置别名
  • QT 引入Quazip和Zlib源码工程到项目中,无需编译成库,跨平台,加密压缩,带有压缩进度
  • Django数据库操作
  • 深入探究 C 语言内存函数:memcpy、memmove、memset 和 memcmp
  • VMware17.6+CentOS 8安装教程
  • 比较Spring AOP和AspectJ
  • [晕事]今天做了件晕事65,gcc,cmake, pragam
  • NGINX配置TCP负载均衡
  • Go基础之环境搭建