張凌楓<2016.11.20>【连续第4天总结】
A.今日任务
1.复习构造函数 类和定义
2.拷贝构造函数
1.复习构造函数 类和定义
2.拷贝构造函数
B.具体任务
1.拷贝构造函数不能重载了嘿
2.当没有自定义的拷贝构造函数时系统会和构造函数一样自动生成一个拷贝构造函数
3.拷贝构造函数没有返回值!!!!!!
4.同类型的对象实例化时,自动调用拷贝构造函数
5.括号 括号 括号 括号 括号
1.拷贝构造函数不能重载了嘿
2.当没有自定义的拷贝构造函数时系统会和构造函数一样自动生成一个拷贝构造函数
3.拷贝构造函数没有返回值!!!!!!
4.同类型的对象实例化时,自动调用拷贝构造函数
5.括号 括号 括号 括号 括号
附代码:
#include <iostream>
#include <string>
using namespace std;
#include <iostream>
#include <string>
using namespace std;
class Mother
{
public:
string Son()
{
return son;
}
string son;
Mother(string SON);
{
public:
string Son()
{
return son;
}
string son;
Mother(string SON);
Mother(const Mother &bugbugbug);
};
};
Mother::Mother(const Mother &bugbugbug)
{
cout<<"烫烫烫烫烫烫烫烫烫烫"<<endl;//出现说明拷贝函数成功!!!!
}
Mother::Mother(string SON)
{
cout<<"成功调用"<<endl;
}
int main()
{
string son1,son2;
cin>>son1;
cin>>son2;
Mother MarthaWayne(son1);
Mother MarthaKent(son2);
Mother F1("23333333333333");//嘲讽一下
Mother F2 = F1;
Mother F3(F2);
cout<<F1.Son();
cout<<"MarthaWayne的儿子是:"<<MarthaWayne.Son()<<endl<<"MarthaKent的儿子是:"<<MarthaKent.Son()<<endl;
cout<<"不是你妈是他妈 超人他妈也叫玛莎"<<endl<<"你妈是我妈 我去救咱妈!!!"<<endl;
//哎呀我去 刘老师《超人大战蝙蝠侠》梗
return 0
}
{
cout<<"烫烫烫烫烫烫烫烫烫烫"<<endl;//出现说明拷贝函数成功!!!!
}
Mother::Mother(string SON)
{
cout<<"成功调用"<<endl;
}
int main()
{
string son1,son2;
cin>>son1;
cin>>son2;
Mother MarthaWayne(son1);
Mother MarthaKent(son2);
Mother F1("23333333333333");//嘲讽一下
Mother F2 = F1;
Mother F3(F2);
cout<<F1.Son();
cout<<"MarthaWayne的儿子是:"<<MarthaWayne.Son()<<endl<<"MarthaKent的儿子是:"<<MarthaKent.Son()<<endl;
cout<<"不是你妈是他妈 超人他妈也叫玛莎"<<endl<<"你妈是我妈 我去救咱妈!!!"<<endl;
//哎呀我去 刘老师《超人大战蝙蝠侠》梗
return 0
}
明日任务
1.依然不变的复习,加上高数啊!!!要考试了QAQ
2.析构函数的学习
1.依然不变的复习,加上高数啊!!!要考试了QAQ
2.析构函数的学习
博客地址:http://blog.csdn.net/night__day