C++?????????????????
???????????? ???????[ 2012/11/21 9:45:56 ] ????????
??????е????βΣ???????β??????????????????(????const????)?????????????????????????????????????????????????????????????????á?
?????????????ж??帴????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????Student.h????
#if !defined(AFX_STUDENT_H__334531D3_6CD2_48F8_BDE2_98A82D166466__INCLUDED_)
#define AFX_STUDENT_H__334531D3_6CD2_48F8_BDE2_98A82D166466__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <string>
class Student
{
public:
Student();
Student(Student&);
virtual ~Student();
std::string name;
unsigned int no;
};
#endif
????Student.cpp??????
#include "Student.h"
Student::Student()
{
}
Student::~Student()
{
}
Student::Student(Student& s)
{
this->name=s.name;
this->no=s.no;
}
????Main.cpp?????а???main??????
#include <iostream>
#include "Student.h"
using namespace std;
int main()
{
Student s;
s.name="zhy_cheng";
s.no=32;
Student liu(s); //??????????????????
cout<<liu.name<<endl<<liu.no<<endl;
return 0;
}
??????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
Student::Student(Student& s)
{
this->name="?????";
this->no=s.no;
}
?????????????????
?????
32
???????????
????????????????????????????????????臨????????private???????????????????????????????????????????????????????????????????????е??????????????????????????????????????????κν??и????????
????????????????????????????и???????????????????е??????????????????????private????????????????????????塣?????????????????????????????????δ?????????κγ???????????????????????????????private??????????????????κθ?????????????????????????е?????????????????????????????????????е??????????????????′???
???????????????帴?????????????????
?????????帴?????????/??????????????????????????á??????????????????????????????????????????????????????????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11