📄
字号:
#include<iostream.h>
#include<string.h>
class studentid
{
public:
studentid(int d=0)
{
value=d;
cout<<"11qiandaodexuesheng ID shi: "<<value<<endl;
}
~studentid()
{
cout<<"12destructing id shi: "<<value<<endl;
}
protected:
int value;
};
class student
{
public:
student(char *pname="no name",int ssID=0):id(ssID)
{
cout<<"21Constructing student "<<pname<<endl;
strncpy(name,pname,sizeof(name));
name[sizeof(name)-1]='\n';
}
~student()
{
cout<<"调用第2个函数"<<endl;
}
protected:
char name[20];
studentid id;
};
void main()
{
student s("zhaoyulong",1986);
student t("wangxu");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -