嗨,我有这个代码,错误是:
UnimplementedFeatureError: Copying of type struct spu_university.all_courses memory[] memory to storage not yet supported.
我怎么才能解决这个问题??
//SPDX-许可证-标识:MIT 现实性=0.4.22<;0.9.0;
合同SPU_COUNTY{
address is_admin;
constructor(){
is_admin = msg.sender;
}
modifier onlyAdmin(address x) {
require(x== is_admin, "Permission Denied. You do not have admin access.");
_; }
uint s_counter=0;
struct students_marks{
uint id;
uint mark;
}
struct all_courses{
string course_name ;
uint mark ;
}
struct warning {
string date ;
string description;
}
struct course {
string name ;
uint id;
uint weekly_hours;
uint level ;
students_marks[] marks;
}
struct prof {
uint id ;
string firstName;
string lastName;
string fatherName;
string motherName;
string gender;
string email;
string collegeName;
string dateOfBirth;
string mobileNumber;
string specialization ;
}
struct student {
uint id ;
string firstName;
string lastName;
string fatherName;
string motherName;
string gender;
string email;
string collegeName;
string dateOfBirth;
string mobileNumber;
all_courses[] course;
warning[] s_warnings;
}
student[] studentList ;
prof[] profList;
course[] courselist;
mapping(uint => student) public getstudent;
mapping(uint => prof) public getprof;
mapping(uint => course) public getcours;
//-注册函数-----
function registerStudent(
uint _id,
string memory _firstName,
string memory _lastName,
string memory _fatherName,
string memory _motherName,
string memory _gender,
string memory _email,
string memory _collegeName,
string memory _dateOfBirth,
string memory _mobileNumber
) onlyAdmin(msg.sender) public {
student memory x= student(_id,_firstName,
_lastName,_fatherName,_motherName,_gender,
_email,_collegeName,_dateOfBirth,
_mobileNumber,
new all_courses[] (0),
new warning[] (0) );
studentList.push(x);
getstudent[_id]=studentList[s_counter];
s_counter ++;
}
}
我试了很多方法都不管用.