C++ 질문이요...ㅠ
빛글
class CCourse{
private:
string subname;
double score;
public:
};
class CStudent{
private:
char name[80];
int stuN;
CCourse **subAry;
public:
CStudent(void);
friend class CCourse;
};
void main()
{
int n;
cout 학생 수를 입력하시오 : ;
cin n;
CStudent *array;
array = new CStudent[n];
getch();
}
CStudent::CStudent(void)
{
int i/*,j*/;
strcpy(name,);
stuN = 0;
(*subAry) = new CCourse[8];-------------------
for(i=0 ; i8 ; i++)
{
(subAry[i]) = new CCourse[6];
//for(j=0 ; j6 ; j++)
//{
//subAry[i][j].subname = ;
//subAry[i][j].score = 0;
//}
}
}
제가 의도하는 것은요,
CStudent객체 안에서 CCourse라는 2차원배열 객체를 생성하고
이거를 동적메모리할당하는 거거든요?
근데 위에처럼 코딩하고 디버깅하면 오류없이 잘 되는데
실행시키면 빨간색 화살표 부분에서 자꾸 오류가 나네요 ㅠㅠ
그리고 주석처리 해놓은 부분을 주석 없애고 하면
디버깅에서 오류가나요
private에 접근할 수 없다고 하는데 이거 권한을 어떻게 줘야하는거져??
friend 쓰려고 햇는데 이거 책읽어도 이해가 안가더라구요 ㅠ
도와주세요!!!ㅠㅠㅠㅠ