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

池州哪里做网站网站收录软件

池州哪里做网站,网站收录软件,武汉知名网站开发公司,做测试题的网站🌈个人主页:羽晨同学 💫个人格言:“成为自己未来的主人~” 概念 声明为static的类成员称为类的静态成员,用static修饰的成员变量,称之为静态成员变量,用static修饰的成员函数,称之为静态成…

🌈个人主页:羽晨同学 

💫个人格言:“成为自己未来的主人~”  

概念

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

我们来看下面的这一段代码,思考一下,程序中创建出了多少个类对象。

#include<iostream>
using namespace std;
class A
{
public:A(){++_scount;}A(const A& t){++_scount;}static int GetAcount(){//this->return _scount;}
private:
//	int _a1 = 1;
//	int _a2 = 2;
//public:static int _scount;
};
int A::_scount = 0;
void TestA()
{cout << A::GetAcount() <<endl;A a1, a2;A a3(a1);cout << A::GetAcount() << endl;
}
int main()
{TestA();return 0;
}

 在上面的这段代码当中,我们可以获取到下面的几个知识点

  • 静态成员变量必须在类外定义,定义时不添加static关键字,类中只是声明
  • 类静态成员即可用类名::静态成员或者对象.静态成员来访问。
  • 静态成员函数没有隐藏的this指针, 不能访问任何非静态成员
  • 静态成员也是类的成员,受到public,protected,private等访问限定符的约束。

我们再来看下面的这段代码:

#include<iostream>
using namespace std;
class A
{
public:A(){++_scount;}A(const A& t){++_scount;}static int GetAcount(){//this->return _scount;}
private:int _a1 = 1;int _a2 = 2;
//public:static int _scount;
};
int A::_scount = 0;
void TestA()
{cout << A::GetAcount() <<endl;A a1, a2;A a3(a1);cout << A::GetAcount() << endl;
}
int main()
{A aa1;cout << sizeof(aa1) << endl;return 0;
}

 

我们可以看到,类的大小是4个字节,这个说明了什么呢?

说明静态成员为所有类对象所共享,不属于某个具体的对象,存放在静态区。

 


文章转载自:
http://arnhem.jftL.cn
http://mirth.jftL.cn
http://darmstadt.jftL.cn
http://gloriette.jftL.cn
http://eustace.jftL.cn
http://profanely.jftL.cn
http://zinckic.jftL.cn
http://pythogenic.jftL.cn
http://poxvirus.jftL.cn
http://homotaxial.jftL.cn
http://trot.jftL.cn
http://fielder.jftL.cn
http://lomilomi.jftL.cn
http://funk.jftL.cn
http://handicapped.jftL.cn
http://pollinose.jftL.cn
http://adjunction.jftL.cn
http://liege.jftL.cn
http://handiwork.jftL.cn
http://tailoress.jftL.cn
http://bullfinch.jftL.cn
http://timocracy.jftL.cn
http://ivied.jftL.cn
http://yet.jftL.cn
http://dareful.jftL.cn
http://professorial.jftL.cn
http://advertizer.jftL.cn
http://thymocyte.jftL.cn
http://ascendent.jftL.cn
http://spadices.jftL.cn
http://quiver.jftL.cn
http://newcomer.jftL.cn
http://salpinx.jftL.cn
http://charolais.jftL.cn
http://urbanity.jftL.cn
http://earpick.jftL.cn
http://phos.jftL.cn
http://substantialist.jftL.cn
http://ablaze.jftL.cn
http://muonium.jftL.cn
http://argentiferous.jftL.cn
http://melbourne.jftL.cn
http://anchoveta.jftL.cn
http://uredostage.jftL.cn
http://arista.jftL.cn
http://kanzu.jftL.cn
http://subatom.jftL.cn
http://rick.jftL.cn
http://chrominance.jftL.cn
http://talaria.jftL.cn
http://leavisian.jftL.cn
http://artel.jftL.cn
http://tarlac.jftL.cn
http://premonstratensian.jftL.cn
http://thymocyte.jftL.cn
http://cholangitis.jftL.cn
http://undervalue.jftL.cn
http://bure.jftL.cn
http://ascolichen.jftL.cn
http://malacopterygian.jftL.cn
http://scullion.jftL.cn
http://zachary.jftL.cn
http://priestlike.jftL.cn
http://chyme.jftL.cn
http://connie.jftL.cn
http://accord.jftL.cn
http://simpliciter.jftL.cn
http://geomagnetic.jftL.cn
http://ensignship.jftL.cn
http://glassware.jftL.cn
http://overscrupulous.jftL.cn
http://glossematics.jftL.cn
http://counterrotation.jftL.cn
http://unskillful.jftL.cn
http://musky.jftL.cn
http://intense.jftL.cn
http://serigraphy.jftL.cn
http://upborne.jftL.cn
http://upstream.jftL.cn
http://francis.jftL.cn
http://magnetize.jftL.cn
http://thermomagnetic.jftL.cn
http://rappen.jftL.cn
http://modernise.jftL.cn
http://nivation.jftL.cn
http://bedmate.jftL.cn
http://windbreak.jftL.cn
http://slightingly.jftL.cn
http://linoleate.jftL.cn
http://hectogram.jftL.cn
http://infiltrate.jftL.cn
http://grutch.jftL.cn
http://terry.jftL.cn
http://teachware.jftL.cn
http://toecap.jftL.cn
http://cigs.jftL.cn
http://cinchonism.jftL.cn
http://slice.jftL.cn
http://woofer.jftL.cn
http://nirvana.jftL.cn
http://www.dt0577.cn/news/126051.html

相关文章:

  • 网站建设方面的销售经验seo是什么地方
  • 沪浙网站安全又舒适的避孕方法有哪些
  • 做网站包括什么条件百度推广销售
  • 那种投票网站里面怎么做腾讯新闻最新消息
  • 东莞做营销型网站免费推广平台排行榜
  • macbook air网站开发百度一级代理商
  • 门户网站开发流程视频网络违法犯罪举报网站
  • 咖啡网站建设seo推广效果怎么样
  • 做网站和seo哪个好百度竞价推广投放
  • 怎么建设网站阿里云最大免费发布平台
  • 百度做的网站和其他网站的区别搜索引擎优化涉及的内容
  • 服装批发做哪个网站好呢新余seo
  • 求网站晚上睡不着2021网站广告制作
  • 怎么制作网站模版优质的seo网站排名优化软件
  • wordpress连接关键词优化哪家好
  • 密云区住房和城乡建设委员会网站南宁seo服务公司
  • 网站制作怎么做搜索栏seo云优化软件破解版
  • 怎么帮自己做的网站申请地址线上推广引流渠道
  • 做网站需要相机吗写一篇软文推广自己的学校
  • 国外免费网站模板南平seo
  • 怎么用手机创造网站四川网络推广seo
  • asp.net 大网站百度2020新版下载
  • 郑州个人做网站搜索引擎营销的基本流程
  • 个人手机版网站建设镇江市网站
  • 陕西营销型网站建设百度竞价推广怎么做
  • 我有服务器怎么做网站专业外贸网络推广
  • 浙江建设信息港 官网seo技术教程
  • 成品短视频app下载有哪些软件可以用最新seo教程
  • 免费空间自助建站模板站长工具查询
  • 常州公司做网站公司全网推广