#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;
}
어제부터 눈이 빠져라 보고있는데 어디에 문제가 있다는건지 도통 모르게씀니다....
불쌍한 중생 하나 구해주세요ㅠㅠㅠㅠㅠㅠㅠ
디버깅해보세여
누가이상있다는거?
컨파일이 해봤어요? - dc App
이런글 올릴거면 어디서 어떤 문제가 일어나는지 정도는 언급을 해라
코드만 달랑 올려서 어쩌라고
지적한 새끼도 뭐가 문제인지 말 안한 것 같음
그런 새끼들은 시간만 낭비시키는 좆같은 부류니까. 바로 알려줄 거 아니면 꺼지라고 하는 게 답
id = 10 잘 출력되는데 다른값을 원하는거임?