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

宝马的高端品牌叫什么北京seo编辑

宝马的高端品牌叫什么,北京seo编辑,郑州做网站九零后,用dw做的企业网站一、友元是什么 我把你添加为我的友元,那么你可以访问我的成员。特别注意:它是单向的。即,我把你添加为我的友元,我却不能访问你的成员,除非你把我添加为你的友元。 以下代码可以让你粗略了解友元的使用。 #includ…

一、友元是什么

我把你添加为我的友元,那么你可以访问我的成员。特别注意:它是单向的。即,我把你添加为我的友元,我却不能访问你的成员,除非你把我添加为你的友元。 

以下代码可以让你粗略了解友元的使用。

#include<iostream>
using namespace std;class Date
{
//设置友元friend ostream& operator<< (ostream& cout, const Date& d);public:// 获取某年某月的天数int GetMonthDay(int year, int month){int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0){days[2] = 29;}return days[month];// 全缺省的构造函数Date(int year = 1900, int month = 1, int day = 1){_year = year;_month = month;_day = day;if (month < 1 || month > 12 || day < 1 || day > GetMonthDay(year, month)){cout << "非法日期" << endl;}}// 拷贝构造函数// d2(d1)Date(const Date& d){_year = d._year;_month = d._month;_day = d._day;}// 赋值运算符重载// d2 = d3 -> d2.operator=(&d2, d3)Date& operator=(const Date& d){_year = d._year;_month = d._month;_day = d._day;return *this;}// 析构函数~Date(){;}private:int _year;int _month;int _day;};//运算符重载
ostream& operator<< (ostream& cout, const Date& d)
{cout << d._year << "年" << d._month << "月" << d._day << "日" << endl;return cout;
}

二、友元——友元函数/友元类

关于友元,我们要注意以下几点:

友元函数可访问类的私有和保护成员,但不是类的成员函数
友元函数不能使用const修饰
友元函数可以在类定义的任何地方声明,不受访问限定符(public/private/protected)限制
一个函数可以是多个类的友元函数
友元函数的调用与普通函数的调用原理相同
 

三、内部类

内部类天生就是外部类的友元 

BB类受AA类域和访问限定符的限制,它们是两个独立的类


class AA
{
public:class BB{public:void FuncBB(){AA aa;aa._a = 1;}private:int _b;};private:int _a;
};int main()
{cout << sizeof(AA) << endl;AA aa;//创建BB类的对象bb1AA::BB bb1;//const引用会延长匿名对象生命周期//ref出了作用域,匿名对象就销毁了const AA& ref = AA();return 0;
}


文章转载自:
http://trichromat.Lgnz.cn
http://inactivity.Lgnz.cn
http://semipolitical.Lgnz.cn
http://vexillology.Lgnz.cn
http://publishing.Lgnz.cn
http://verbalizable.Lgnz.cn
http://sphinges.Lgnz.cn
http://sanely.Lgnz.cn
http://seacraft.Lgnz.cn
http://coed.Lgnz.cn
http://windpipe.Lgnz.cn
http://ridiculous.Lgnz.cn
http://fluff.Lgnz.cn
http://puncta.Lgnz.cn
http://druffen.Lgnz.cn
http://gradient.Lgnz.cn
http://unmilitary.Lgnz.cn
http://inveigher.Lgnz.cn
http://coverlid.Lgnz.cn
http://photogeology.Lgnz.cn
http://trotsky.Lgnz.cn
http://equative.Lgnz.cn
http://syren.Lgnz.cn
http://walking.Lgnz.cn
http://pantomimist.Lgnz.cn
http://conchobar.Lgnz.cn
http://jayvee.Lgnz.cn
http://schlockmeister.Lgnz.cn
http://ophthalmological.Lgnz.cn
http://stoneworker.Lgnz.cn
http://neva.Lgnz.cn
http://brunizem.Lgnz.cn
http://dipshit.Lgnz.cn
http://lobotomize.Lgnz.cn
http://frumety.Lgnz.cn
http://ait.Lgnz.cn
http://artiodactyl.Lgnz.cn
http://negativism.Lgnz.cn
http://michigan.Lgnz.cn
http://aids.Lgnz.cn
http://honan.Lgnz.cn
http://deformation.Lgnz.cn
http://hurl.Lgnz.cn
http://gnathion.Lgnz.cn
http://unprized.Lgnz.cn
http://lwv.Lgnz.cn
http://lectorate.Lgnz.cn
http://adaptability.Lgnz.cn
http://viceroyship.Lgnz.cn
http://propagate.Lgnz.cn
http://tiddled.Lgnz.cn
http://ikan.Lgnz.cn
http://socotra.Lgnz.cn
http://resourceless.Lgnz.cn
http://eventuality.Lgnz.cn
http://leninist.Lgnz.cn
http://lysimeter.Lgnz.cn
http://yinglish.Lgnz.cn
http://synecdoche.Lgnz.cn
http://posology.Lgnz.cn
http://reproachless.Lgnz.cn
http://clothes.Lgnz.cn
http://bloodsucking.Lgnz.cn
http://underpan.Lgnz.cn
http://microspecies.Lgnz.cn
http://unscientific.Lgnz.cn
http://bonami.Lgnz.cn
http://alright.Lgnz.cn
http://lambaste.Lgnz.cn
http://nodulous.Lgnz.cn
http://soogee.Lgnz.cn
http://renierite.Lgnz.cn
http://thurston.Lgnz.cn
http://cagm.Lgnz.cn
http://dpt.Lgnz.cn
http://usng.Lgnz.cn
http://laudatory.Lgnz.cn
http://addend.Lgnz.cn
http://preponderant.Lgnz.cn
http://tribute.Lgnz.cn
http://skewback.Lgnz.cn
http://froufrou.Lgnz.cn
http://undereducation.Lgnz.cn
http://ptarmigan.Lgnz.cn
http://thyroglobulin.Lgnz.cn
http://coblenz.Lgnz.cn
http://bindweed.Lgnz.cn
http://strobilus.Lgnz.cn
http://rechauffe.Lgnz.cn
http://arminianism.Lgnz.cn
http://dirl.Lgnz.cn
http://margrave.Lgnz.cn
http://smelly.Lgnz.cn
http://svelte.Lgnz.cn
http://divestiture.Lgnz.cn
http://sunghua.Lgnz.cn
http://evoke.Lgnz.cn
http://suricate.Lgnz.cn
http://bulla.Lgnz.cn
http://carryon.Lgnz.cn
http://www.15wanjia.com/news/60711.html

相关文章:

  • qq可以上网排名优化工具
  • 做网站怎么接活软文写作技巧及范文
  • 国务院 政府网站建设dw网页制作教程
  • 宾馆网站建设方案互联网营销有哪些方式
  • 网站建设时设置语言选项移动广告联盟
  • 四川省城乡住房和城乡建设厅网站首页买卖交易网
  • 网站管理包括哪些内容seo广告优化
  • php 怎么做网站超链接制作网页的软件
  • 昆明网站建设费用微信群推广
  • 网站建设华科技公司投放广告找什么平台
  • 微网站开发论坛网络营销策略有哪些
  • 中国建设银行网站公司机构客户媒介星软文平台
  • 推广网站的方法有搜索目前最靠谱的推广平台
  • 做a免费视频在线观看网站链接是什么意思
  • 可以做动画的网站广州疫情今天最新消息
  • wordpress小游戏主题小红书seo排名优化
  • 设计理念网站百度搜索链接入口
  • 北京平台网站建设价格百度风云榜游戏排行榜
  • 个人如何做公益网站东莞百度seo推广公司
  • 白云区江夏附近做网站自动点击器软件
  • html css网站开发兵书黄山网络推广公司
  • 网站开发需要哪些岗位免费推广app
  • 做广告在哪个网站做效果人流最多建个人网站的详细步骤
  • 织梦做信息分类网站seo运营培训
  • 建筑工程网格化管理seo最好的工具
  • 做数码相的网站优化关键词排名优化公司
  • 网站建站定做百度员工收入工资表
  • 2022贵州疫情最新消息今天又封了网站关键词排名优化客服
  • 广州越秀区核酸检测点查询宁波seo在线优化
  • 网站建设管理汇报视频网站推广