【发布时间】:2018-08-04 09:23:16
【问题描述】:
我想将学生传给 group ,但我的代码不起作用 我才开始写代码,谁能解释一下它是如何工作的
//file Group.h
class Group{
public:
Group(Students *array[] , int size); // pointer. hard to understand
};
//main.cpp
int main() {
int number = 9;
Students students[number];
Group group(students ,number) //build failed. for some reason
return 0;
}
【问题讨论】:
-
“不工作”根本没有帮助。
-
此时您最好的选择是这些C++ books。 C++ 不能靠猜测来学习。
-
将构造函数声明改为
Group(Students *array , int size)或Group(Students array[] , int size)。 -
"build failed. for some reason" - 我很确定编译器会告诉你它失败的确切原因。否则你应该得到一个更好的编译器
-
您的函数需要学生指针数组
标签: c++