1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
 
using namespace std;
 
class Student
{
private :
    char name[10];
    int age;
    int studentID;
public :
    Student(char * _name, int _age, int _studentID) : age(_age), studentID(_studentID)
    {
        strcpy(name, _name);
    }
    void GetInfo()
    {
        cout << "name: " << name << endl;
        cout << "age: " << age << endl;
        cout << "studentID: " << studentID << endl;
    }
};
 
int main()
{
    Student * student[3];
    char name[10];
    int age, studentID;
 
    for (int i = 0; i < 3; i++)
    {
        cin >> name >> age >> studentID;
        student[i] = new Student(name, age, studentID);
    }
    for (int i = 0; i < 3; i++)
    {
        student[i]->GetInfo();
    //질문1 왜 student[i].Getinfo(); 는 안되는지?
    }
    delete student[0];
    delete student[1];
    delete student[2];
    // 질문2 왜 delete[] student; 하면 안되는지?
 
    return 0;
}
 
cs

38열 43열 질문 하나씩있습니다 형님들