📄
字号:
#include <iostream>
using namespace std;
class Student
{
public:
Student(char *pName = "no name", int ssId=0);
Student(const Student& Stu);
~Student();
protected:
private:
int m_ID;
char m_cName[40];
};
Student::Student(char *pName, int ssId)
{
m_ID = ssId;
strcpy(m_cName, pName);
cout << "construct new student" <<endl;
}
Student::Student(const Student& Stu)
{
m_ID = Stu.m_ID;
strcpy(m_cName, Stu.m_cName);
cout << "construct copy of" << Stu.m_cName << endl;
}
Student::~Student()
{
cout << "destructing" << endl;
}
void Fun(const Student& s)
{
cout << "in fun()" << endl;
}
void main()
{
Student randy("randy", 1234);
Fun(randy);
cout << "returned from fun()" << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -