c++结构体重载运算符出现0xC0000005: 写入位置 0xcdcdcdcd 时发生访问冲突错误,怎么解决求大神!
这汇编看不懂~~~右边的数据传进去了,但是左边提示<错误的指针>部分代码如下:typedefstructstu//学生结构体(含学生信息和学生成绩){typedefstr...
这汇编看不懂~~~
右边的数据传进去了,但是左边提示<错误的指针>
部分代码如下:
typedef struct stu//学生结构体(含学生信息和学生成绩)
{
typedef struct StuInfo//学生信息
{
string stuNo;
string stuBrithday;
string stuIdno;
string stuName;
string stuSex;
StuInfo &operator = (StuInfo &student)
{
stuBrithday = student.stuBrithday;
stuIdno = student.stuIdno;
stuName = student.stuName;
stuSex = student.stuSex;
stuNo = student.stuNo;
return *this;
}
}stuInfo;
stuInfo stu_info;
typedef struct StuScore//学生成绩
{
int stuMath;
int stuEnglish;
int stuDatastruct;
StuScore &operator = (StuScore &student)
{
stuDatastruct = student.stuDatastruct;
stuEnglish = student.stuEnglish;
stuMath = student.stuMath;
return *this;
}
}stuScore;
stuScore stu_score;
stu &operator = (stu &student)
{
stu_info = student.stu_info;
stu_score = student.stu_score;
return *this;
}
}Stu; 展开
右边的数据传进去了,但是左边提示<错误的指针>
部分代码如下:
typedef struct stu//学生结构体(含学生信息和学生成绩)
{
typedef struct StuInfo//学生信息
{
string stuNo;
string stuBrithday;
string stuIdno;
string stuName;
string stuSex;
StuInfo &operator = (StuInfo &student)
{
stuBrithday = student.stuBrithday;
stuIdno = student.stuIdno;
stuName = student.stuName;
stuSex = student.stuSex;
stuNo = student.stuNo;
return *this;
}
}stuInfo;
stuInfo stu_info;
typedef struct StuScore//学生成绩
{
int stuMath;
int stuEnglish;
int stuDatastruct;
StuScore &operator = (StuScore &student)
{
stuDatastruct = student.stuDatastruct;
stuEnglish = student.stuEnglish;
stuMath = student.stuMath;
return *this;
}
}stuScore;
stuScore stu_score;
stu &operator = (stu &student)
{
stu_info = student.stu_info;
stu_score = student.stu_score;
return *this;
}
}Stu; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询