【C++类和对象】日期类的实现

💞💞 前言

hello hello~ ,这里是大耳朵土土垚~💖💖 ,欢迎大家点赞🥳🥳关注💥💥收藏🌹🌹🌹
在这里插入图片描述

💥个人主页:大耳朵土土垚的博客
💥 所属专栏:C++入门至进阶
这里将会不定期更新有关C++的内容,希望大家多多点赞关注收藏💖💖

目录

  • 💞💞 前言
  • 1.日期类Date的构造
  • 2.日期类Date的实现
    • 2.1获取某年某月的天数
    • 2.2默认成员函数的实现
      • 2.2.1全缺省的构造函数
      • 2.2.2拷贝构造函数
      • 2.2.3赋值运算符重载
      • 2.2.4析构函数
    • 2.3日期计算类函数
      • 2.3.1日期+=天数
      • 2.3.2日期+天数
      • 2.3.3日期-=天数
      • 2.3.4日期-天数
      • 2.3.5日期-日期 返回天数
    • 2.4运算符重载类函数
      • 2.4.1 >运算符重载
      • 2.4.2 ==运算符重载
      • 2.4.3 >=运算符重载
      • 2.4.4 <运算符重载
      • 2.4.5 <=运算符重载
      • 2.4.6 !=运算符重载
      • 2.4.7 前置++与后置++
      • 2.4.8 前置--与后置--
  • 3.完整代码+运行结果
  • 4.结语

通过下面的学习我们将构建简单日期计算器的各种功能实现:
在这里插入图片描述

1.日期类Date的构造

这里的函数大多在日期类中声明,定义在类外部实现

#include<iostream>
using namespace std;
class Date
{
public:// 获取某年某月的天数inline int GetMonthDay(int year, int month){int montharray[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };//如果是二月就需要判断是不是闰年if (month == 2 &&(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))){return 29;}return montharray[month];//月份天数数组设置为13,方便直接按月份返回}// 全缺省的构造函数Date(int year = 1900, int month = 1, int day = 1);// 拷贝构造函数// d2(d1)Date(const Date& d);// 赋值运算符重载// d2 = d3 -> d2.operator=(&d2, d3)Date& operator=(const Date& d){if (*this != d){_year = d._year;_month = d._month;_day = d._day;return *this;}}// 析构函数~Date();//打印日期void Print(){cout << _year << "/" << _month << "/" << _day << endl;}// 日期+=天数Date& operator+=(int day);// 日期+天数Date operator+(int day);// 日期-天数Date operator-(int day);// 日期-=天数Date& operator-=(int day);// 前置++Date& operator++();// 后置++Date operator++(int);// 后置--Date operator--(int);// 前置--Date& operator--();// >运算符重载bool operator>(const Date& d);// ==运算符重载bool operator==(const Date& d);// >=运算符重载bool operator >= (const Date& d);// <运算符重载bool operator < (const Date& d);// <=运算符重载bool operator <= (const Date& d);// !=运算符重载bool operator != (const Date& d);// 日期-日期 返回天数int operator-(const Date& d);private:int _year;int _month;int _day;};

日期Date类主要分为成员函数与成员变量两个模块,
成员变量就是上面的 int _year; int _month;int _day;是私有(private)的,这样做的目的是不想让别人得到自己的数据;
成员函数可以分为三类:

  1. 默认成员函数
  2. 日期计算类函数
  3. 运算符重载函数

成员函数是公有的(public),也就是说我们在类的外部也可访问和使用;下面我们将实现这些函数。

2.日期类Date的实现

2.1获取某年某月的天数

// 获取某年某月的天数
inline int GetMonthDay(int year, int month)
{int montharray[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };//如果是二月就需要判断是不是闰年if (month == 2 &&(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))){return 29;}return montharray[month];//月份天数数组设置为13,方便直接按月份返回
}

这个函数对于我们后面完整实现日期类有着重要的作用,很多情况下都需要调用它,所以我们在最开始实现并将它设置成内联函数,以提高效率;
此外内联函数声明和定义最好不要分离,否则会出现链接错误,所以这里我们直接在类里面定义;

2.2默认成员函数的实现

2.2.1全缺省的构造函数


// 全缺省的构造函数
Date:: Date(int year, int month, int day)
{_year = year;_month = month;_day = day;//这里可以判断日期是否合理if (month >= 13 && day > GetMonthDay(year, month)){cout << "日期非法输入" << endl;}
}

注意这里在声明的时候给缺省值,定义的时候不写;全缺省的构造函数除了赋值外,如果用户输入13月或者2月31天等不正确的日期,我们还可以在函数内部判断日期是否非法;

2.2.2拷贝构造函数

// 拷贝构造函数
// d2(d1)
Date:: Date(const Date& d)
{_year = d._year;_month = d._month;_day = d._day;
}

2.2.3赋值运算符重载

	// 赋值运算符重载// d2 = d3 -> d2.operator=(&d2, d3)Date& operator=(const Date& d){if (*this != d){_year = d._year;_month = d._month;_day = d._day;return *this;}}

赋值运算符重载如果在类中不显式实现,编译器会生成一个默认的。此时用户再在类外自己实现一个全局的赋值运算符重载,就和编译器在类中生成的默认赋值运算符重载冲突了,故赋值运算符重载只能是类的成员函数。所以我们在类里面声明和定义一起;

2.2.4析构函数

//析构函数
Date::~Date()
{_year = 0;_month = 0;_day = 0;
}

对于没有申请资源的类比如日期类,析构函数可以不写直接使用系统默认生成的就行;

2.3日期计算类函数

2.3.1日期+=天数

// 日期+=天数
Date& Date::operator+=(int day)
{_day += day;while (_day > GetMonthDay(_year, _month)){_day -= GetMonthDay(_year, _month);_month++;if (_month >= 13){_year++;_month = 1;}}return *this;
}

这里采用日满了月就+1,月满了年就+1的方式,此外还要注意每个月的天数都不同,2月不同年份天数也不同分为平年和润年,这就需要使用我们之前实现过的获取某年某月天数的函数了;和日期+天数不同的是,日期+=天数,自己原来的日期会变成+了天数之后的,而日期+天数原来的日期不变, 例如:
在这里插入图片描述d1+=100之后,d1也变了;
这里介绍另一个成员函数Print();
void Print() { cout << _year << "/" << _month << "/" << _day << endl; } 用来打印日期,包含在类里面;

2.3.2日期+天数

// 写法1:日期+天数
Date Date::operator+(int day)
{Date tmp = *this;tmp += day;//利用之前实现过的+=实现return tmp;
}
//写法2:日期+天数
Date Date::operator+(int day)
{
Date tmp = *this;
tmp._day += day;
while (tmp._day > GetMonthDay(tmp._year, tmp._month))
{tmp._day -= GetMonthDay(tmp._year, tmp._month);tmp._month++;if (tmp._month >= 13){tmp._year++;tmp._month = 1;}}
return tmp;
}

因为日期+天数,原来的日期是不变的,所以我们需要创建一个临时变量来存放+天数之后的日期并返回;这里有两种写法,一种对之前实现的+=直接使用,另一种就是再自己写一遍+的代码(和+=类似);

2.3.3日期-=天数

// 日期-=天数
Date& Date::operator-=(int day)
{_day -= day;while (_day < 0){_month--;if (_month == 0){_year--;_month = 12;}_day += GetMonthDay(_year, _month);}return *this;
}

2.3.4日期-天数

// 日期-天数
Date Date::operator-(int day)
{Date tmp = *this;/*tmp._day -= day;while (tmp._day < 0){tmp._month--;if (tmp._month == 0){tmp._year--;tmp._month = 12;}tmp._day += GetMonthDay(tmp._year, tmp._month);}*/tmp -= day;return tmp;
}

2.3.5日期-日期 返回天数

// 日期-日期 返回天数
int Date::operator-(const Date& d)
{//先找较大的日期Date max = *this;Date min = d;//如果*this的日期比d大的话就正常计数int flag = 1;//如果*this的日期比d小的话就先正常计数之后再*(-1)即可,-1用flag来标识if (*this < d){min = *this;max = d;flag = -1;}int CountDay = 0;while (min < max){++min;CountDay++;}return flag * CountDay;
}

这里注意如果日期1-日期2<0;就要返回负数,反之返回正数;
所以我们使用flag来标识;
此外计算两个日期相差的天数可以直接++日期并利用CountDay来记录++了多少次,直到两个日期相等时,CountDay的值就是两个日期的差值,类似于追及问题;
当然也有别的方法来实现这里就写了这一种

2.4运算符重载类函数

2.4.1 >运算符重载

// >运算符重载
bool Date::operator>(const Date& d)
{//先比较年if (_year > d._year)return true;//比较月if (_year == d._year && _month > d._month)return true;//比较天if ((_year == d._year) && (_month == d._month) && (_day > d._day))return true;return false;}

2.4.2 ==运算符重载

// ==运算符重载
bool Date::operator==(const Date& d)
{if ((_year == d._year) && (_month == d._month) && (_day == d._day))return true;return false;
}

2.4.3 >=运算符重载

// >=运算符重载
bool Date::operator >= (const Date& d)
{if (*this > d || *this == d)return true;return false;
}

只需写了 > 和 == 或者 < 和 == 这两个运算符,后面的运算符重载就可以借助这两个运算符直接实现;

2.4.4 <运算符重载

// <运算符重载
bool Date::operator < (const Date& d)
{return !(*this >= d);
}

2.4.5 <=运算符重载

// <=运算符重载
bool Date::operator <= (const Date& d)
{return !(*this > d);
}

2.4.6 !=运算符重载

// !=运算符重载
bool Date::operator != (const Date& d)
{return !(*this == d);
}

2.4.7 前置++与后置++

  • 前置++

返回++之后的值

// 前置++
Date& Date::operator++()
{/*_day++;if (_day > GetMonthDay(_year, _month)){_month++;if (_month >= 13){_year++;}}*/*this += 1;return *this;
}

可以直接写,也可以利用前面实现的+=来实现

  • 后置++

返回++之前的值

// 后置++
Date Date::operator++(int)
{Date tmp = *this;/*_day++;if (_day > GetMonthDay(_year, _month)){_month++;if (_month >= 13){_year++;}}*/*this += 1;return tmp;
}

这里因为是返回++之前的值,所以需要创建一个临时变量来存储++之前的日期并返回

2.4.8 前置–与后置–

  • 前置–
// 前置--
Date& Date::operator--()
{return *this -= 1;
}
  • 后置–
// 后置--
Date Date:: operator--(int)
{Date tmp = *this;*this -= 1;return tmp;
}

3.完整代码+运行结果

  • date.h
#pragma once
#include<iostream>
using namespace std;
class Date
{friend ostream& operator<<(ostream& out, const Date& d);friend istream& operator>>(istream& in, Date& d);public:// 获取某年某月的天数inline int GetMonthDay(int year, int month){int montharray[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };//如果是二月就需要判断是不是闰年if (month == 2 && (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))){return 29;}return montharray[month];}// 全缺省的构造函数Date(int year = 1900, int month = 1, int day = 1);// 拷贝构造函数// d2(d1)Date(const Date& d);// 赋值运算符重载// d2 = d3 -> d2.operator=(&d2, d3)Date& operator=(const Date& d){if (*this != d){_year = d._year;_month = d._month;_day = d._day;return *this;}}// 析构函数~Date();// 日期+=天数Date& operator+=(int day);// 日期+天数Date operator+(int day);// 日期-天数Date operator-(int day);// 日期-=天数Date& operator-=(int day);// 前置++Date& operator++();// 后置++Date operator++(int);// 后置--Date operator--(int);// 前置--Date& operator--();// >运算符重载bool operator>(const Date& d);// ==运算符重载bool operator==(const Date& d);// >=运算符重载bool operator >= (const Date& d);// <运算符重载bool operator < (const Date& d);// <=运算符重载bool operator <= (const Date& d);// !=运算符重载bool operator != (const Date& d);// 日期-日期 返回天数int operator-(const Date& d);void Print(){cout << _year << "/" << _month << "/" << _day << endl;}private:int _year;int _month;int _day;};
  • date.cpp
 #define _CRT_SECURE_NO_WARNINGS 1
#include"date.h"// 全缺省的构造函数
Date::Date(int year, int month, int day)
{_year = year;_month = month;_day = day;//这里可以判断日期是否合理if (month >= 13 && day > GetMonthDay(year, month)){cout << "日期非法输入" << endl;}
}// 拷贝构造函数// d2(d1)
Date::Date(const Date& d)
{_year = d._year;_month = d._month;_day = d._day;
}// 日期+=天数
Date& Date::operator+=(int day)
{_day += day;while (_day > GetMonthDay(_year, _month)){_day -= GetMonthDay(_year, _month);_month++;if (_month >= 13){_year++;_month = 1;}}return *this;
}// 日期+天数
Date Date::operator+(int day)
{Date tmp = *this;//tmp._day += day;//while (tmp._day > GetMonthDay(tmp._year, tmp._month))//{// tmp._day -= GetMonthDay(tmp._year, tmp._month);//	tmp._month++;//	if (tmp._month >= 13)//	{//		tmp._year++;//		tmp._month = 1;//	}//	//}tmp += day;return tmp;
}// 日期-=天数
Date& Date::operator-=(int day)
{_day -= day;while (_day < 0){_month--;if (_month == 0){_year--;_month = 12;}_day += GetMonthDay(_year, _month);}return *this;
}// 日期-天数
Date Date::operator-(int day)
{Date tmp = *this;/*tmp._day -= day;while (tmp._day < 0){tmp._month--;if (tmp._month == 0){tmp._year--;tmp._month = 12;}tmp._day += GetMonthDay(tmp._year, tmp._month);}*/tmp -= day;return tmp;
}// 前置++
Date& Date::operator++()
{/*_day++;if (_day > GetMonthDay(_year, _month)){_month++;if (_month >= 13){_year++;}}*/*this += 1;return *this;
}// 后置++
Date Date::operator++(int)
{Date tmp = *this;/*_day++;if (_day > GetMonthDay(_year, _month)){_month++;if (_month >= 13){_year++;}}*/*this += 1;return tmp;
}// 后置--
Date Date:: operator--(int)
{Date tmp = *this;*this -= 1;return tmp;
}// 前置--
Date& Date::operator--()
{return *this -= 1;
}// >运算符重载
bool Date::operator>(const Date& d)
{//先比较年if (_year > d._year)return true;//比较月if (_year == d._year && _month > d._month)return true;//比较天if ((_year == d._year) && (_month == d._month) && (_day > d._day))return true;return false;}// ==运算符重载
bool Date::operator==(const Date& d)
{if ((_year == d._year) && (_month == d._month) && (_day == d._day))return true;return false;
}// >=运算符重载
bool Date::operator >= (const Date& d)
{if (*this > d || *this == d)return true;return false;
}// <运算符重载
bool Date::operator < (const Date& d)
{return !(*this >= d);
}// <=运算符重载
bool Date::operator <= (const Date& d)
{return !(*this > d);
}// !=运算符重载
bool Date::operator != (const Date& d)
{return !(*this == d);
}// 日期-日期 返回天数
int Date::operator-(const Date& d)
{//先找较大的日期Date max = *this;Date min = d;//如果*this的日期比d大的话就正常计数int flag = 1;//如果*this的日期比d小的话就先正常计数之后再*(-1)即可,-1用flag来标识if (*this < d){min = *this;max = d;flag = -1;}int CountDay = 0;while (min < max){++min;CountDay++;}return flag * CountDay;
}//析构函数
Date::~Date()
{_year = 0;_month = 0;_day = 0;
}//	//流输出
//ostream operator<<(ostream& out, const Date d)
//{
//	out << d._year << "/" << d._month << "/" << d._day << endl;
//	return out;
//}
//
//
流插入
//istream operator>>(istream& in, const Date d)
//{
//	in >> d._year;
//}//流插入
ostream& operator<<(ostream& out, const Date& d)
{out << d._year << "/" << d._month << "/" << d._day << endl;return out;
}//流提取
istream& operator>>(istream& in, Date& d)
{in >> d._year >> d._month >> d._day;return in;
}
  • test.cpp
int main()
{Date d1(2024, 4, 20);cout << "Today is " << endl;d1.Print();cout << "往后100天是:" << endl;Date(d1 + 100).Print();cout << "往前100天是:" << endl;Date(d1 - 100).Print();cout << "今天与2004年12月14日相差:" << endl;int day = d1 - Date(2004, 12, 14);cout << day << endl;return 0;
}

结果如下:

在这里插入图片描述

4.结语

以上只是一个简单的日期类示例,实际的日期类可能还包括其他功能,例如日期的格式化等操作。这里只是提供了一个起点,大家可以根据自己的需求对日期类进行扩展。以上就是简单日期类的所有内容啦 ~ 完结撒花 ~🥳🎉🎉

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/3846.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Post请求中常见的Content-Type类型

Post请求中常见的Content-Type类型的结构 &#xff08;1&#xff09;application/x-www-form-urlencoded 这是浏览器原生的form表单类型&#xff0c;或者说是表单默认的类型。 下面是一个请求实例&#xff1a; 请求报文&#xff1a; 可以看得出&#xff0c;post将请求参数以k…

了解时间复杂度和空间复杂度

在学习数据结构前&#xff0c;我们需要了解时间复杂度和空间复杂度的概念&#xff0c;这能够帮助我们了解数据结构。 算法效率分为时间效率和空间效率 时间复杂度 一个算法的复杂度与其执行的次数成正比。算法中执行基础操作的次数&#xff0c;为算法的时间复杂度。 我们采…

网络安全实训Day23

网络空间安全实训-渗透测试 文件上传攻击 定义 将Webshell文件上传到网站服务器上&#xff0c;从而获得网站整台服务器控制权限的攻击方式 Webshell 一种以网页形式存在的命令行执行环境&#xff0c;又称网页木马 分类 一句话木马 只有一行代码&#xff0c;功能强大&#xff…

【程序分享1】LAMMPS + OVITO + 晶体缺陷识别 + 点缺陷 + 分子动力学模拟

分享2个分子动力学模拟相关的程序。 1. 一种识别体心立方晶体缺陷的新方法。 2. 无后处理的分子动力学模拟中的并行点缺陷识别: lammps的计算和转储方式 。 感谢论文的原作者&#xff01; 第1个程序 关键词&#xff1a; 1. Atomistic simulations, 2. Molecular dynamics…

PFA容量瓶耐受强酸强碱进口特氟龙材质定容瓶

PFA容量瓶&#xff0c;也叫特氟龙容量瓶&#xff0c;是用于配制标准浓度溶液的实验室器皿&#xff0c;是有着细长颈、梨形肚的耐强腐蚀平底塑料瓶&#xff0c;颈上有标线&#xff0c;可直接配置标准溶液和准确稀释溶液以及制备样品溶液。 因其有着不易碎、材质纯净、化学稳定性…

OpenHarmony实战开发-按钮 (Button)

Button是按钮组件&#xff0c;通常用于响应用户的点击操作&#xff0c;其类型包括胶囊按钮、圆形按钮、普通按钮。Button做为容器使用时可以通过添加子组件实现包含文字、图片等元素的按钮。具体用法请参考Button。 创建按钮 Button通过调用接口来创建&#xff0c;接口调用有…

Mudem,打造私密安全、高效稳定的私人空间

Mudem 是 Codigger 平台中的一个关键组件&#xff0c;它提供基础通讯服务&#xff0c;确保不同类型的机器之间可以进行安全和高效的连接。它其设计理念在于将本地机器、公有云以及私有云上的设备无缝地整合为一个可远程在线访问的工作站&#xff08;Workstation&#xff09;。这…

【数据库】MongoDB

文章目录 [toc]数据库操作查询数据库切换数据库查询当前数据库删除数据库查询数据库版本 数据集合操作创建数据集合查询数据集合删除数据集合 数据插入插入id重复的数据 数据更新数据更新一条丢失其他字段保留其他字段 数据批量更新 数据删除数据删除一条数据批量删除 数据查询…

Python脚本实现PC端大麦网自动购票(Selenium自动化测试工具)

文章目录 Selenium 简介Selenium webdriver 文档chromedriver&#xff08;谷歌浏览器驱动&#xff09;chromedriver 下载配置环境变量 大麦网购票脚本网页 dom 元素 启用远程调试&#xff08;操作已打开的窗口&#xff09; Selenium 简介 Selenium 是一个用于自动化测试的工具…

如何查看自己的公网IP?

我们在网络中&#xff0c;每一个设备都被分配了一个唯一的IP地址&#xff0c;用以区分和识别其他设备。公网IP地址是指可被公众访问的IP&#xff0c;是因特网上的全球唯一标识。当我们需要查看自己的公网IP时&#xff0c;可以采取以下几种方式。 使用命令行查看公网IP 在Windo…

算法06链表

算法06链表 一、链表概述1.1概述1.2链表的组成部分&#xff1a;1.3链表的优缺点&#xff1a; 二、链表典例力扣707.设计链表难点分析&#xff1a;&#xff08;1&#xff09;MyLinkedList成员变量的确定&#xff1a;&#xff08;2&#xff09;初始化自定义链表&#xff1a;&…

06.JAVAEE之线程4

1.定时器 1.1 定时器是什么 定时器也是软件开发中的一个重要组件. 类似于一个 " 闹钟 ". 达到一个设定的时间之后 , 就执行某个指定好的代码. 约定一个时间,时间到达之后,执行某个代码逻辑, 定时器非常常见,尤其是在进行网络通信的时候, 需要有等待的最大时间&…

Linux之线程管理

目录 第1关&#xff1a;创建线程 任务描述 相关知识 使用pthread_create函数创建线程 编程要求 答案&#xff1a; 第2关&#xff1a;线程挂起 任务描述 相关知识 使用pthread_join挂起线程 编程要求 答案&#xff1a; 第3关&#xff1a;线程终止 任务描述 相关知识 使用pthread…

18种WEB常见漏洞:揭秘网络安全的薄弱点

输入验证漏洞: 认证和会话管理漏洞: 安全配置错误: 其他漏洞: 防范措施: Web 应用程序是现代互联网的核心&#xff0c;但它们也容易受到各种安全漏洞的影响。了解常见的 Web 漏洞类型&#xff0c;对于开发人员、安全测试人员和普通用户都至关重要。以下将介绍 18 种常见的 …

MySQL—MySQL的存储引擎之InnoDB

MySQL—MySQL的存储引擎之InnoDB 存储引擎及种类 存储引擎说明MyISAM高速引擎&#xff0c;拥有较高的插入&#xff0c;查询速度&#xff0c;但不支持事务InnoDB5.5版本后MySQL的默认数据库存储引擎&#xff0c;支持事务和行级锁&#xff0c;比MyISAM处理速度稍慢ISAMMyISAM的…

Android Studio查看viewtree

前言&#xff1a;之前开发过程一直看的是手机上开发者选项中的显示布局边界&#xff0c;开关状态需要手动来回切换&#xff0c;今天偶然在Android Studio中弄出了布局树觉得挺方便的。

JPEG图像常用加密算法简介

JPEG图像加密算法 目前&#xff0c;JPEG图像加密算法可以分成异或加密、置乱加密和置乱与异或组合加密。下面对这三种加密方式进行阐述。 (1) 异或加密 文献[1]提出了一种基于异或加密的JPEG图像的RDH-EI方案。该算法通过对AC系数的ACA和图像的量化表进行流密码异或&#xf…

代码随想录训练营Day 33|Python|Leetcode|● 理论基础 ● 509. 斐波那契数 ● 70. 爬楼梯 ● 746. 使用最小花费爬楼梯

理论基础 动态规划五步曲 确定dp数组&#xff08;dp table&#xff09;以及下标的含义确定递推公式dp数组如何初始化确定遍历顺序举例推导dp数组 509. 斐波那契数 斐波那契数 &#xff08;通常用 F(n) 表示&#xff09;形成的序列称为 斐波那契数列 。该数列由 0 和 1 开始…

vue3——笔记2(计算属性,类与样式绑定)

计算属性 在 Vue3 中&#xff0c;计算属性的用法和 Vue2 基本上是一样的&#xff0c;但是在性能上有了一些改进。Vue3 中计算属性是通过computed函数来创建的&#xff0c;计算属性的值会在相关依赖发生改变时自动更新。与 Vue2 相比&#xff0c;Vue3 的计算属性在一些场景下会…

某翻译平台翻译接口逆向之webpack学习

逆向网址 aHR0cHM6Ly9mYW55aS55b3VkYW8uY29tLw 逆向链接 aHR0cHM6Ly9mYW55aS55b3VkYW8uY29tLyMv 逆向接口 aHR0cHM6Ly9kaWN0LnlvdWRhby5jb20vd2VidHJhbnNsYXRl 逆向过程 请求方式 POST 逆向参数 sign c168e4cb76169e90f82d28118dbd24d2 接口请求结果解密 过程分析 根据XHR…