【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.mfbz.cn/a/567107.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【MATLAB源码-第64期】matlab基于DWA算法的机器人局部路径规划包含动态障碍物和静态障碍物。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 动态窗口法&#xff08;Dynamic Window Approach&#xff0c;DWA&#xff09;是一种局部路径规划算法&#xff0c;常用于移动机器人的导航和避障。这种方法能够考虑机器人的动态约束&#xff0c;帮助机器人在复杂环境中安全、…

PCB上有哪些元素

过孔&#xff1a;是用来切换层的 丝印&#xff1a;就是标记&#xff08;白色的线或者符号&#xff09; 焊盘&#xff1a;焊接元器件&#xff0c;相当于线头&#xff0c;连接各个元件 通孔埋孔盲孔&#xff0c;都是用来换层&#xff0c;内部没有桐&#xff0c;是用来固定的 线路…

C++:基础语法

一、命名空间 在C/C中&#xff0c;变量、函数和后面要学到的类都是大量存在的&#xff0c;这些变量、函数和类的名称将都存在于全局作用域中&#xff0c;可能会导致很多冲突。使用命名空间的目的是对标识符的名称进行本地化&#xff0c; 以避免命名冲突或名字污染&#xff0c;n…

uniapp微信小程序(商城项目)

最近&#xff0c;闲来无事&#xff0c;打算学一下uniapp小程序 于是在跟着某站上学着做了一个小程序&#xff0c;主要是为了学uniapp和vue。某站黑马优购 完成的功能主要有&#xff1a;首页、搜索、分类和购物车。 有人问了为什么没有登录、和添加订单呢&#xff1f;问的很好…

2.4 Web容器配置:Tomcat

2.4 Web容器配置 2.4.1Tomcat配置1.常规配置2. HTTPS配置 *********** 2.4.1Tomcat配置 1.常规配置 在SpringBoot项目中&#xff0c;可以内置Tomcat、Jetly、Undertow、Netty等容器。 当开发者添加了spring-boot-starter-web依赖之后&#xff0c;默认会使用Tomcat作为Web容器…

【Linux学习】初始冯诺漫体系结构

文章目录 认识冯诺依曼系统 认识冯诺依曼系统 什么是冯诺依曼体系结构&#xff1f; 冯诺依曼体系结构是一种将程序指令和数据以二进制形式存放在主存储器中&#xff0c;由中央处理器统一控制和执行的计算机系统结构。冯诺依曼体系结构实现了程序的可编程性和硬件与软件的分离&…

【C语言】每日一题,快速提升(10)!

&#x1f525;博客主页&#x1f525;&#xff1a;【 坊钰_CSDN博客 】 欢迎各位点赞&#x1f44d;评论✍收藏⭐ 题目&#xff1a;圣诞树 输入&#xff1a; 1输出&#xff1a; * * * * * **说明&#xff1a; 输入&#xff1a; 2输出&#xff1a; * * * * * * * …

【C++】一篇文章带你深入了解list

目录 一、list的介绍二、 标准库中的list类2.1 list的常见接口说明2.1.1 list对象的常见构造2.1.1.1 [无参构造函数](https://legacy.cplusplus.com/reference/list/list/list/)2.1.1.2 [有参构造函数(构造并初始化n个val)](https://legacy.cplusplus.com/reference/list/list/…

idea配置推荐插件详细讲解

配置插件是为了在开发过程中提高效率、改善开发体验而安装的。在IntelliJ IDEA中&#xff0c;你可以按照以下步骤配置插件&#xff1a; 打开插件配置页面&#xff1a; ● 在顶部菜单栏中选择 “File” -> “Settings”&#xff08;或者使用快捷键 Ctrl Alt S&#xff09;…

相亲平台app小程序

相亲平台app小程序是一种基于手机应用的微型程序&#xff0c;专为在线相亲交友活动设计。它提供了一系列的功能&#xff0c;旨在帮助用户更方便、更高效地找到心仪的伴侣。 首先&#xff0c;用户可以在个人资料部分上传照片、填写个人资料、设置兴趣爱好等信息&#xff0c;以便…

【行为型模型】迭代器模式

一、迭代器模式概述 迭代器模式定义&#xff1a;提供一种方法顺序访问一个聚合对象中的各个元素&#xff0c;而又不暴露其内部的表示。把游走的任务放在送代器上&#xff0c;而不是聚合上。这样简化了聚含的接口和实现,也让责任各得其所。(对象行为型) 迭代器模式的优缺点&…

uni-app开发canvas绘图画画,记录每一步画的信息, 并实现后退功能

在uni-app中&#xff0c;要实现canvas绘图并记录每一步的信息以实现后退功能&#xff0c;你需要做几件事&#xff1a; 初始化Canvas上下文&#xff1a;首先&#xff0c;你需要在页面加载时初始化canvas上下文。 记录绘图步骤&#xff1a;在绘图过程中&#xff0c;你需要记录每…

20240416,深拷贝浅拷贝,对象初始化和清理,对象模型和THIS指针

哈哈哈乌龟越狱了 目录 2.5 深拷贝&浅拷贝 2.6 初始化列表 2.7 类对象作为类成员 2.8 静态成员 2.9 成员变量和成员函数分开存储 2.10 THIS指针的用途 2.11 空指针访问成员函数 2.12 COSNT修饰成员函数 2.5 深拷贝&浅拷贝 浅拷贝&#xff1a;简单的赋值拷贝…

揭秘分销系统:商业模式的新风向

大家好&#xff0c;我是微三云周丽&#xff0c;今天给大家分析当下市场比较火爆的商业模式&#xff01; 小编今天跟大伙们分享什么是分销系统&#xff1f; 在数字化浪潮席卷全球的今天&#xff0c;电子商务以其独特的优势&#xff0c;正在重塑商业世界的格局。其中&#xff0…

css设置输入框边框无效或者不展示边框

bug描述&#xff1a;在聚焦的时候&#xff0c;期望输入框的边框是主题色&#xff0c;但是不知道是个啥颜色。 发现输入框input以及textarea样式css标签:focus更改样式无效这个问题。 若希望实现input在触发焦点时更改样式&#xff0c;通常会想到使用:focus选择器&#xff0c;…

积极探索新质生产力,九河云携手华为云技术交流引领数智跃迁

4月18日&#xff0c;九河云携手华为云举办了华为云SA技术培训会议&#xff0c;培训邀请到华为云技术人员作为主讲人&#xff0c;通过理论讲解与案例结合的方式&#xff0c;围绕ECS和EBS之间的联动&#xff0c;调优和数据保护等方面展开&#xff0c;深入浅出地讲解了基于EBS部署…

uniapp 引用组件后 不起作用 无效果 不显示

根据uniapp官方文档easycom组件规范 只要组件安装在项目的components目录下或uni_modules目录下&#xff0c;并符合components/组件名称/组件名称.(vue|uvue)目录结构&#xff08;注意&#xff1a;当同时存在vue和uvue时&#xff0c;uni-app 项目优先使用 vue 文件&#xff0c;…

浅谈防火墙,IPS,APT威胁检测的互补性

在学习网络安全产品时发现很多产品的目的与功能大同小异都是防范非法流量或威胁&#xff0c;但是既然有产品的差异就有作用的目的的差异&#xff0c;下面浅谈一下三个网络安全产品的差异化与互补点 防火墙 传统防火墙主要是工作在二到四层&#xff0c;不会对报文的载荷进行检…

App Cleaner Uninstaller中文激活版:mac最强深度清理软件

App Cleaner & Uninstaller 是一款适用于 Mac 操作系统的软件应用程序&#xff0c;允许用户轻松卸载不需要的应用程序、删除剩余文件和文件夹以及管理启动项。该应用程序会分析与您要删除的应用程序关联的文件&#xff0c;并帮助识别其所有组件&#xff0c;以便您可以一次将…

中红医疗:纷享销客CRM系统如何助力​数字化“狂飙”

纷享销客深耕 CRM 多年&#xff0c;可以顺畅打通 CRM 和 ERP 系统客户资源池&#xff0c;将金蝶苍穹平台的物料、产品基础主数据作为档案同步到纷享销客&#xff0c;以便商务维护好产品及库存。 纷享销客通过成熟的集成方案提高系统耦合性&#xff0c;让销售实时获得新产品及营…