#include <iostream>

#include <string>

using namespace std;


class person{

int id;

public:

person(int id = 0) { this->id = id; }

~person() { cout << "id = " << id << endl; }

};


class student : public person {

char* name;

public:

student( int id, char* name ) : person(id) {

int len = strlen(name);

this->name = new char[len+1];

strcpy(this->name, name);

}

~student() {

cout << "name = " << name << endl;

delete[] name;

}

};


int main() {

person *p = new student(10, "손연재");

delete p;

}




어제부터 눈이 빠져라 보고있는데 어디에 문제가 있다는건지 도통 모르게씀니다....

불쌍한 중생 하나 구해주세요ㅠㅠㅠㅠㅠㅠㅠ