1,const和类
Classstudent.cpp代码如下:
#include "pch.h"
#include <iostream>
#include "Cstudent.h"
using namespace std;
int main(int argc, char* argv[])
{
Cstudent stu((char*)"li", (char*)"a001", 80);
stu.print();
return 0;
}
Cstudent.cpp代码如下:
#include "pch.h"
#include "Cstudent.h"
#include <iostream>
using namespace std;
Cstudent::Cstudent(char* myName, char* myNum, float myScore):matchScore(myScore)
{
strcpy_s(name, myName);
strcpy_s(stuNum, myNum);
}
Cstudent::Cstudent(char* myName, char* myNum):matchScore(0)
{
strcpy_s(name, myName);
strcpy_s(stuNum, myNum);
}
Cstudent::~Cstudent(void)
{
}
void Cstudent::setName(char* myName)
{
strcpy_s(name , myName);
}
void Cstudent::setNum(char* myNum)
{
str