【类和对象】4

日期类的拓展

c语言中的printf函数只能打印内置类型,为了弥补这一不足,c++利用运算符重载可以打印自定义类型。

void operator<<(ostream&out);//声明在date.h中
void Date::operator<<(ostream& out)//定义在date.cpp中
{
	out<<this->_year <<"年" << this->_month<<"月" << this->_day<<"日";

}
int main()//.cpp中
{
	Date d1(2024, 3, 30);
	d1.operator<<(cout);
 

}

如果我们修改成这样呢.cpp

int main()
{
	Date d1(2024, 3, 30);

   //d1.operator<<(cout);
	cout << d1;

 

}

在这里插入图片描述
由于我们的运算符重载是定义在日期类里面的,所以默认*this是左操作数,所以类定义的对象必须放在左边。修改如下:

int main()
{
	Date d1(2024, 3, 30);

   //d1.operator<<(cout);
	d1<<cout;
}

如果我们就要使类对象在右边呢?
所以我们必须将该函数放在全局,但是放在全局的话,类对象的变量都是私有,就不能访问到,我们先改成共有:

void operator<<(ostream& out, Date& d);//声明放全局在date.h中
void operator<<(ostream& out, Date& d)//定义在date.cpp中
{
	out << d._year << "年" << d._month << "月" << d._day << "日";

}
int main()//在.cpp中
{
	Date d1(2024, 3, 30);

   //d1.operator<<(cout);
	cout<<d1;

 

}

如果我们不将变量改成共有,我们全局函数怎么才能访问到类成员变量呢?

friend void operator<<(ostream& out, Date& d);

在声明中加上这个,使全局的函数成为类的友元函数,就可以访问类的变量了。


我们知道变量可以连续赋值,这里可以支持连续输出吗?
在这里插入图片描述
赋值运算符从右向左,先把q的值赋值为10,然后再把q的值赋给p,然后把p的值赋给i,实现连续赋值,因此需要返回值

ostream& operator<<(ostream& out, Date& d)//定义
{
	out << d._year << "年" << d._month << "月" << d._day << "日";
	return out;

}
ostream& operator<<(ostream& out, Date& d);//声明
int main()
{
	Date d1 = (2002, 3, 11);
	Date d2 = (2012, 3, 11);

	cout << d1 << d2;

}

既然能输出自定义类型,那怎么使用运算符重载函数实现自定义类型输入呢?
实现如下:

istream& operator>>(istream& in, Date& d);//声明在date.h全局
istream& operator>>(istream& in, Date& d)//date.cpp定义
{
	in>>d._year >> d._month >> d._day ;
	return in;

}
int main()
{
	Date d1 ;
	Date d2 ;
	cin >> d1 >> d2;//给输入

	cout << d1 << d2;//输出

	

}

日期类的安全性修改

比如,如果输入不合法,就提示,我们需要写一个检测的函数
修改后的日期类
date.h

#pragma once
#include<iostream>
using namespace std;
class Date

{

public:

	// 获取某年某月的天数

	int GetMonthDay(int year, int 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);



	// 析构函数

	~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);

	bool  isvalid(Date& d);

	// 日期-日期 返回天数

	int operator-(const Date& d);

	void print();
	/*void operator<<(ostream&out);*/
	friend ostream & operator<<(ostream& out, Date& d);
	friend istream& operator>>(istream& in, Date& d);
private:

	int _year;

	int _month;

	int _day;

};
ostream& operator<<(ostream& out, Date& d);
istream& operator>>(istream& in, Date& d);

date.cpp

#include "date.h"
Date::Date(int year, int month, int day)
{
	_year = year;
	_month = month;
	_day = day;
	if (!(this->isvalid(*this)))
	{
		cout << "初始化非法" << endl;
	}

}
void Date:: print()
{
	cout << _year << "." << _month << "." << _day<<endl;
}
Date::Date(const Date& d)
{
	
	_year = d._year;
	_month = d._month;
	_day = d._day;




}
Date::~Date()
{
	
	_year = 0;
	_month = 0;
	_day = 0;


}
int Date:: GetMonthDay(int year, int month)
{
	int arr[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 arr[month];

}
Date& Date:: operator=(const Date& d)
{
	if (this != &d)
	{
		_year = d._year;
		_month = d._month;
		_day = d._day;
	}
	return *this;




}
Date & Date::operator+=(int day)
{
	_day+= day;
	while (_day > GetMonthDay(_year,_month))
	{
		_day -= GetMonthDay(_year, _month);
		_month++;
		if (_month == 13)
		{
			_month = 0;
		}



	}
	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._month = 0;
		}



	}
	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);
	return tmp;


}
bool Date:: operator>(const Date& d)
{
	if (_year > d._year)
	{
		return true;
	}
	else
	{
		if (_year == d._year)
		{
			if (_month > d._month)
			{
				return true;
			}
			else
			{
				if (_month == d._month)
				{
					if (_day > d._day)
						return true;
				}
			}
		}




	}
	return false;


}
bool Date::operator==(const Date& d)
{
	return (_year == d._year) && (_month == d._month) &&( _day == d._day);





}
bool Date:: operator >= (const Date& d)
{
	return   *this > (d) || *this == (d);


}

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));

}

Date& Date::operator++()
{
	*this = *this + 1;
	return *this;




}

Date Date:: operator++(int)
{

	Date tmp = *this;
	*this=*this+ 1;
	return tmp;

}

Date Date::operator--(int)
{
	Date tmp =*this;
	*this=*this-1;
	return tmp;


}
Date& Date:: operator--()
{
	*this = *this - 1;
	return *this;


}



int Date::operator-(const Date& d)
{
	Date max = *this;
	Date min = d;
	int flag = 1;
	if (min > (max))
	{
		max = d;
		min = *this;
		flag = -1;

	}
	int n = 0;
	while (max != min)
	{
		n++;
		min++;




	}
	return flag*n;





}
bool Date::isvalid(Date& d)
{
	if (_year < 0 || _month <= 0 || _month>12 || _day<1 || _day>GetMonthDay(_year, _month))
	{
		return false;
	}
	true;




}
ostream& operator<<(ostream& out, Date& d)
{
	out << d._year << "年" << d._month << "月" << d._day << "日";
	return out;

}
istream& operator>>(istream& in, Date& d)
{
	while (1)
	{
		cout << "请输入时间" << endl;
		in >> d._year >> d._month >> d._day;
		if (!d.isvalid(d))
		{
			cout << "输入不合法" << endl;
		}
		else
		{
			break;
		}



		
	}
	return in;
}

权限问题

首先看一个问题
在这里插入图片描述
在这里插入图片描述
我们这里调用print函数发现调用不动
在这里插入图片描述


应该怎么修改呢?
在printhan函数的声明和定义后面加上const

void Date:: print() const//定义
{
	cout << _year << "." << _month << "." << _day<<endl;
}
void print() const;//声明

此时该函数中*this指向的内容不能被修改。现在调用相当于权限平移,就可以了。


此时我们的print函数时加了const

int main()
{
	Date d1 ;
	Date d2(2003,3,3);
	const Date d3(2002,1,2);
	d3.print();
	d2.print();
	

	

}

d2是非const的类对象,也能调用const函数print,因为权限缩小了,所以可以。

总结
成员函数,如果是一个对成员变量只进行读访问的函数,建议函数+const,这样const对象和非const对象都可以使用
如果一个对成员变量要进行读写访问的函数,不能加const,否则不能修改成员变量

  1. const对象可以调用非const成员函数吗? 权限放大
  2. 非const对象可以调用const成员函数吗? 权限缩小
  3. const成员函数内可以调用其它的非const成员函数吗?权限放大
  4. 非const成员函数内可以调用其它的const成员函数吗?权限缩小

权限放大和缩小和平移适用于指针和引用

取地址及const取地址操作符重载

这两个默认成员函数一般不用重新定义 ,编译器默认会生成。

class Date
{ 
public :
 Date* operator&()
 {
 return this ;

 }
 const Date* operator&()const
 {
 return this ;
 }
private :
 int _year ; // 年
 int _month ; // 月
 int _day ; // 日
};

这两个运算符一般不需要重载,使用编译器生成的默认取地址的重载即可,只有特殊情况,才需要重载,比如想让别人获取到指定的内容!

初始化列表

在创建对象时,编译器通过调用构造函数,给对象中各个成员变量一个合适的初始值。

class Date
{
public:
Date(int year, int month, int day)
 {
     _year = year;
     _month = month;
     _day = day;
    _year=1;
 }
private:
int _year;
int _month;
int _day;
};

虽然上述构造函数调用之后,对象中已经有了一个初始值,但是不能将其称为对对象中成员变量的初始化,构造函数体中的语句只能将其称为赋初值,而不能称作初始化。因为初始化只能初始化一次,而构造函数体内可以多次赋值。

初始化列表:以一个冒号开始,接着是一个以逗号分隔的数据成员列表,每个"成员变量"后面跟一个放在括号中的初始值或表达式。

class Date
{
public:
Date(int year, int month, int day)

     : _year(year)
     , _month(month)
     , _day(day)
 {}
private:
int _year;
int _month;
int _day;
};

因为我们的常量,引用必须在定义的时候初始化。

#include<iostream>
using namespace std;
class Date
{
public:
    Date(int year, int month, int day)
    {
        _year = year;
        _month = month;
        _day = day;
        _year = 1;
        n = 1;
    }
private:
    int _year;
    int _month;
    int _day;
    const int n;
};

int main()

{
	Date d1(2003, 3, 11);


}

在这里插入图片描述

所以我们常量初始化一定要放在初始化列表中。

#include<iostream>
using namespace std;
class Date
{
public:
	Date(int year, int month, int day)
		:n(1)
		, _year(year)
		, _month(month)
		, _day(day)
	{
	
	
	}
private:
	int _year;
	int _month;
	int _day;
	const int n;
};

int main()

{
	Date d1(2003, 3, 11);


}

引用类型必须在初始化时候给初值

#include<iostream>
using namespace std;
class Date
{
public:
	Date(int year, int month, int day,int&p)
		:n(3)
		, _year(year)
		, _month(month)
		, _day(day)
		,x(p)
	{
	
	
	}
private:
	int _year;
	int _month;
	int _day;
	const int n=1;
	int& x;
};

int main()

{
	int num = 5;
	Date d1(2003, 3, 11,num);


}

p是num的别名,而x又是p的别名。

3.当我们类成员变量里面有自定义类型的话,并且我们没有在初始化列表初始化,初始化列表会给他调用他自己的默认构造函数完成初始化。(这里的默认构造是我们写的全缺省构造函数)

#include<iostream>
using namespace std;
class A
{
public:
	A(int a=3)
		:_a(a)
	{
		cout << "调用" << endl;
	}
private:
	int _a;
};
class Date
{
public:
	Date(int year, int month, int day,int&p)
		:n(3)
		, _year(year)
		, _month(month)
		, _day(day)
		,x(p)
		
	{
	
	
	}
private:
	int _year;
	int _month;
	int _day;
	const int n=1;
	int& x;
	A cou;
};

int main()

{
	int num = 5;
	Date d1(2003, 3, 11,num);


}

如果A dou对象没有默认构造呢(默认构造包括全缺省,无参,系统生成的,这里构造有参,所以没有默认构造)

我们可以在初始化列表给自定义类型初始化。

#include<iostream>
using namespace std;
class A
{
public:
	A(int a)
		:_a(a)
	{
		cout << "调用" << endl;
	}
private:
	int _a;
};
class Date
{
public:
	Date(int year, int month, int day,int&p)
		:n(3)
		, _year(year)
		, _month(month)
		, _day(day)
		,x(p)
		,cou(5)
		
	{
	
	
	}
private:
	int _year;
	int _month;
	int _day;
	const int n=1;
	int& x;
	A cou;
};

int main()

{
	int num = 5;
	Date d1(2003, 3, 11,num);


}

在这里插入图片描述
【注意】

  1. 每个成员变量在初始化列表中只能出现一次(初始化只能初始化一次)
  2. 类中包含以下成员,必须放在初始化列表位置进行初始化:
  • 引用成员变量
  • const成员变量
  • 自定义类型成员(且该类没有默认构造函数时)

同时也可以在初始化列表给指针初始化,可以在初始化列表中检查空间是否申请

#include<iostream>
#include<stdlib.h>
using namespace std;
class A
{
public:
	A(int a)
		:_a(a)
	{
		cout << "调用" << endl;
	}
private:
	int _a;
};
class Date
{
public:
	Date(int year, int month, int day,int&p)
		:n(3)
		, _year(year)
		, _month(month)
		, _day(day)
		,x(p)
		,cou(5)
		,ptr((int*)malloc(sizeof(int)))
		
	{
		if (ptr == NULL)
		{
			perror("malloc fail");


		}
	
	}
private:
	int _year;
	int _month;
	int _day;
	const int n=1;
	int& x;
	A cou;
	int* ptr;
};

int main()

{
	int num = 5;
	Date d1(2003, 3, 11,num);


}

总结:声明的缺省参数是给初始化列表的,如果初始化列表没有给一个变量初始化,这个变量就拿的是缺省参数的值,自定义类型如果初始化列表没有初始化,就会去调用自己的默认构造函数,来进行初始化,如果没有默认构造函数的话,就要看对象实例化的时候有没有给自己写的构造函数有没有传值,如果没有的话,就是随机值,如果初始化列表给自定义类型初始化了,就没有上面的一系列操作了,初始化列表后还可以在括号里面给变量赋值(除了那3个)相当于构造函数。


单参数构造函数支持隐式类型转换

#include<iostream>
#include<stdlib.h>
using namespace std;
class C
{
public:

	C(int x = 0)
		:_x(x)
	{}

	C(const C& cc)
	{
		cout << "C(const C& cc)" << endl;
	}

private:
	int _x;
};
int main()
{

	C cc2 = 2;

}

在这里插入图片描述
编译器优化,连续步骤的·构造,一般会合二为一

和隐式类型转化差不多
在这里插入图片描述

如果我们的自定义的对象没有在初始化列表中初始化,并且也没有自己的默认构造函数的话,我们要给缺省值给自定义对象赋值,我们必须在全局实例化一个类对象,然后将该类对象拷贝构造给里面的自定义变量。

#include<iostream>
#include<stdlib.h>
using namespace std;
class C
{
public:
	
	C(int x = 0)
		:_x(x)
	{}

	C(const C& cc)
	{
		cout << "C(const C& cc)" << endl;
	}

private:
	int _x;
};
class Stack
{
public:
	void Push(const C& c)
	{
		
	}
};

int main()
{
	

	Stack st;
	C cc3(3);
	st.Push(cc3);

	st.Push(3);

	return 0;
}

这里如果我们要入一个C类的对cc3,并且cc3类成员变量初始化为3,本来我们需要先给cc3对象赋值,然后再将C类对象cc3入栈,现在支持单参数构造函数支持隐式类型转换,就可以入栈一个类成员变量初始化为3,并且是C类对象。
在这里插入图片描述

c++11支持多参数构造函数支持隐式类型转换

#include<iostream>
#include<stdlib.h>
using namespace std;
class A
{
public:
	
	A(int a1, int a2)
		:_a1(a1)
		,_a2(a2)
	{}

private:
	int _a1;
	int _a2;
};

int main()
{
	
	A aa1 = { 1, 2 };
	

	return 0;
}

explicit关键字

#include<iostream>
#include<stdlib.h>
using namespace std;
class A
{
public:
	explicit A(int a1, int a2)
		:_a1(a1)
		,_a2(a2)
	{}

private:
	int _a1;
	int _a2;
};

int main()
{
	
	A aa1 = { 1, 2 };
	

	return 0;
}

用explicit修饰构造函数,将会禁止构造函数的隐式转换。

成员变量在类中声明次序就是其在初始化列表中的初始化顺序,与其在初始化列表中的先后次序无关

class A
{
public:
    A(int a)
       :_a1(a)
       ,_a2(_a1)
   {}
    
    void Print() {
        cout<<_a1<<" "<<_a2<<endl;
   }
private:
    int _a2;
    int _a1;
};
int main() {
    A aa(1);
    aa.Print();
}

上述代码会出现什么情况?D
A. 输出1 1
B.程序崩溃
C.编译不通过
D.输出1 随机值
因为是按照声明次序初始化,所以_a2初始化的时候,_a1还没有初始化,所以_a2是随机值,然后_a1按照初始化列表初始化为1

static成员

概念
声明为static的类成员称为类的静态成员,用static修饰的成员变量,称之为静态成员变量;用static修饰的成员函数,称之为静态成员函数。静态成员变量一定要在类外进行初始化

class A
{
public:
	A()
	{
		
	}

	A(const A& aa)
	{
		
	}

	

private:
	
	

	int a = 0;
};



A Func()
{
	A aa;

	return aa;
}

int main()
{
	A aa1;
	A aa2;
	
	Func();




	return 0;
}

实现一个类,计算程序中创建出了多少个类对象
1.我们定义一个全局变量统计构造函数和拷贝构造函数调用了多少次

#include<iostream>
#include<stdlib.h>
using namespace std;
int n = 0;
class A
{
public:
	A()
	{
		n++;
	}

	A(const A& aa)
	{
		n++;
	}



private:



	int a = 0;
};



A Func()
{
	A aa;

	return aa;
}

int main()
{
	A aa1;
	A aa2;

	Func();

	cout << n << endl;


	return 0;
}

2.由于全局变量可以在任意位置被修改,我们将n定义在类中,但是类中的n是私有的,我们可以使用静态变量static,然后去掉私有,但是static 必须在类外面定义初始化,这时候n就可以在每个类对象中使用了(突破类域使用n)

#include<iostream>
#include<stdlib.h>
using namespace std;

class A
{
public:
	A()
	{
		n++;
	}

	A(const A& aa)
	{
		n++;
	}







	int a = 0;
	static int n;
};

int A::n = 0;

A Func()
{
	A aa;

	return aa;
}

int main()
{
	A aa1;
	A aa2;

	Func();
	cout << aa1.n << endl;
	cout << aa2.n << endl;
	cout << A::n << endl;


	return 0;
}

3.使用静态函数返回静态变量,静态函数中没有this指针,只能操作静态变量。

#include<iostream>
#include<stdlib.h>
using namespace std;

class A
{
public:
	A()
	{
		n++;
	}

	A(const A& aa)
	{
		n++;
	}

	static int GetN()
	{
		
		return n;
	}




private:

	int a = 0;
	static int n;
};

int A::n = 0;

A Func()
{
	A aa;

	return aa;
}

int main()
{
	A aa1;
	A aa2;
	
	Func();
	cout << aa1.GetN() << endl;
	cout << A::GetN() << endl;
	

	return 0;
}

特性

  1. 静态成员为所有类对象所共享,不属于某个具体的对象,存放在静态区
  2. 静态成员变量必须在类外定义,定义时不添加static关键字,类中只是声明
  3. 类静态成员即可用 类名::静态成员 或者 对象.静态成员 来访问
  4. 静态成员函数没有隐藏的this指针,不能访问任何非静态成员
  5. 静态成员也是类的成员,受public、protected、private 访问限定符的限制

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

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

相关文章

Flutter解析后台发来的jwt字段数据,了解jwt是否过期

前言 了解JWT是什么可以看这一篇博文 JWT&#xff08;JSON Web Token&#xff09;详解以及在go-zero中配置的方法-CSDN博客 流程 采用jwt_decoder库 添加至pubspec.yaml jwt_decoder: ^2.0.1 解析字段 查看是否过期 获取过期时间和token颁发的年龄

PythonStudio 控件使用常用方式(五)TListBox

PythonStudio是一个极强的开发Python的IDE工具&#xff0c;它使用的是Delphi的控件&#xff0c;常用的内容是与Delphi一致的。但是相关文档并一定完整。现在我试试能否逐步把它的控件常用用法写一点点&#xff0c;也作为PythonStudio的参考。 TListBox是列表框 常用属性 col…

【操作系统·考研】I/O管理概述

1.I/O设备 1.1 块设备 信息交换以数据块为单位&#xff0c;它属于有结构设备。 块设备传输速率较高&#xff0c;可寻址&#xff0c;且可对该设备随机地的读写。 栗子&#x1f330;&#xff1a;磁盘。 1.2 字符设备 信息交换以字符为单位&#xff0c;属于无结构类型。 字符…

LabVIEW叶片厚度远程监控

LabVIEW叶片厚度远程监控 随着网络技术的高速发展&#xff0c;远程监控广泛应用在各个领域。本文介绍了一种基于LabVIEW的植物叶片厚度远程监控系统&#xff0c;旨在实现对植物生长状况的精准监测和分析。 该系统利用LabVIEW软件开发工具&#xff0c;通过TCP网络协议实现数据…

关于反爬虫的的概述

目录 前言 一、验证码验证 二、IP限制 三、User-Agent限制 四、动态页面加载 总结 前言 反爬虫是一种防止网站被自动程序&#xff08;爬虫&#xff09;访问和抓取数据的技术手段。在网络爬虫的发展和使用过程中&#xff0c;有一部分爬虫是用于非法获取网站数据、侵犯隐私…

删除有序数组中的重复项 II[中等]

优质博文&#xff1a;IT-BLOG-CN 一、题目 给你一个有序数组nums&#xff0c;请你原地删除重复出现的元素&#xff0c;使得出现次数超过两次的元素只出现两次 &#xff0c;返回删除后数组的新长度。不要使用额外的数组空间&#xff0c;你必须在原地修改输入数组并在使用O(1)额…

Java基于SpringBoot+Vue的美容院管理系统,附源码,文档

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…

20240202在Ubuntu20.04.6下使用whisper.cpp的显卡模式

20240202在Ubuntu20.04.6下使用whisper.cpp的显卡模式 2024/2/2 19:43 【结论&#xff1a;在Ubuntu20.04.6下&#xff0c;确认large模式识别7分钟中文视频&#xff0c;需要356447.78 ms&#xff0c;也就是356.5秒&#xff0c;需要大概5分钟&#xff01;效率太差&#xff01;】 …

electron项目在内网环境的linux环境下进行打包

Linux需要的文件: electron-v13.0.0-linux-x64.zip appimage-12.0.1.7z snap-template-electron-4.0-1-amd64.tar.7z 下载慢或者下载失败的情况可以手动下载以上electron文件复制到指定文件夹下&#xff1a; 1.electron-v13.0.0-linux-x64.zip 复制到~/.cache/electron/目录下…

web前端--------渐变和过渡

线性渐变&#xff0c;是指颜色沿一条直线进行渐变&#xff0c;例如从上到下、从左到右。 当然&#xff0c;CSS中也支持使用角度来设置渐变的方向&#xff0c;角度单位为deg。 0deg&#xff0c;为12点钟方向&#xff0c;表示从下到上渐变。 90deg&#xff0c;为3点钟方向&…

海外社媒营销平台及运营规则,如何降低封号率?

社交媒体已经成为人们生活和日常习惯不可或缺的一部分&#xff0c;在跨境电商出海过程中&#xff0c;海外社媒营销平台可以起到非凡的助力&#xff1b;而平台的选择以及平台的运营技巧、规则都各有不同。很多海外社媒工作者经常会被封号&#xff0c;这也是难度之一&#xff0c;…

吸猫毛空气净化器哪个好?推荐除猫毛效果好的宠物空气净化器品牌

如今&#xff0c;越来越多的家庭选择养宠物&#xff0c;使家庭变得更加温馨。然而&#xff0c;养宠物可能会带来异味和空气中的毛发增多&#xff0c;这可能会成为一大困扰&#xff0c;并对健康造成问题。 为了不让家里充斥着异味&#xff0c;特别是来自宠物便便的味道&#xf…

无人零售模式下,“IoT+鸿蒙”实现零代码搭建自动售货机监控大屏的可能性摸索

前言 新零售模式下&#xff0c;对loT的探索与应用还在继续。 而数字时代&#xff0c;数字化转型在零售行业中蔓延&#xff0c;而对于新的消费方式的探索&#xff0c;也在如火如荼的进行中。于是&#xff0c;一种新零售的形式——无人零售逐渐形成概念。 如果说&#xff0c;人…

微信小程序新手入门教程二:认识JSON配置文件

在上一篇我们介绍了微信小程序的注册和基本使用方式&#xff0c;并且写出了一个简单的页面&#xff0c;但是依然没有解释目录中的各种.json文件是做什么的。这篇我们就来认识一下各种JSON配置文件及其配置项。 一 认识JSON 首先先来认识一下JSON是什么。 JSON 指的是 JavaScri…

25.泛型

泛型 1.泛型1.1 概述1.2 代码示例 2. 泛型类2.1 概述2.2 代码示例 3. 泛型方法3.1 概述3.2 代码示例 4. 泛型接口4.1 概述4.2 代码示例 5. 泛型特点5.1 概述5.2 代码示例 6. 泛型通配符6.1 概述6.2 代码示例 7. 综合案例8. 注意事项 1.泛型 泛型是Java编程语言的一项重要功能&…

故障诊断 | 一文解决,CNN-LSTM卷积神经网络-长短期记忆神经网络组合模型的故障诊断(Matlab)

效果一览 文章概述 故障诊断 | 一文解决,CNN-LSTM卷积神经网络-长短期记忆神经网络组合模型的故障诊断(Matlab) 模型描述 CNN-LSTM模型是一种结合了卷积神经网络(Convolutional Neural Network)和长短期记忆神经网络(Long Short-Term Memory)的组合模型,常用于数据故障…

FPGA解码MIPI视频:Xilinx Artix7-35T低端FPGA,基于MIPI CSI-2 RX Subsystem架构实现,提供工程源码和技术支持

目录 1、前言免责声明 2、相关方案推荐我这里已有的 MIPI 编解码方案本方案在Xilinx Artix7-100T上解码MIPI视频的应用本方案在Xilinx Kintex7上解码MIPI视频的应用本方案在Xilinx Zynq7000上解码MIPI视频的应用本方案在Xilinx Zynq UltraScale上解码MIPI视频的应用纯VHDL代码解…

vite和vue-cli实现原理和优化及区别

Vite&#xff1a; 1. 实现原理&#xff1a; Vite 是一个基于 ESModule 的构建工具。它利用原生 ESModule 的特性&#xff0c;将每个文件作为一个模块&#xff0c;通过浏览器去解析和执行&#xff0c;而不需要提前将文件打包成一个单独的 bundle。Vite 利用浏览器的原生 ESMod…

适用于汽车 4D 成像雷达的双器件毫米波级联参考设计(TI文档)

说明 该汽车雷达参考设计是一个 76GHz 至 81GHz 的级联雷达传感器模块。这包括由 AWR2243 器件和AM2732R 雷达处理器构成的双器件级联阵列。在这一级联雷达配置中&#xff0c;一个主器件向主器件和辅助器件分配20GHz 的本机振荡器 (LO) 信号&#xff0c;使这两个器件作为单个射…

Windows Server 2019 Web服务器搭建

系列文章目录 提示&#xff1a;这里可以添加系列文章的所有文章的目录&#xff0c;目录需要自己手动添加 例如&#xff1a;第一章 Python 机器学习入门之pandas的使用 提示&#xff1a;写完文章后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目…
最新文章