#include <iostream>
using namespace std;
namespace COMP_POS
{
enum { CLERK, SENIOR, ASSIST, MANAGER };
}
class NameCard {
public:
NameCard(char* name1, char* company1, char* Pnumber1, int position1)
{
name = new char+;
name = name1;
company = new char[50];
company = company1;
Pnumber = new char[50];
Pnumber = Pnumber1;
position = position1;
if (position == 0)
charpos = "사원";
if (position == 1)
charpos = "주임";
if (position == 2)
charpos = "대리";
}
NameCard(const NameCard& copy)
{
name = new char+;
name = copy.name;
company = new char[50];
company = copy.company;
Pnumber = new char[50];
Pnumber = copy.Pnumber;
charpos = copy.charpos;
}
~NameCard()
{
delete[] name;
delete[] company;
delete[] Pnumber;
}
public:
void ShowNameCardInfo() {
cout << "이름: " << name << endl;
cout << "회사: " << company << endl;
cout << "전화번호: " << Pnumber << endl;
cout << "직급: " << charpos << endl << endl;
}
private:
char* name;
char* company;
char* Pnumber;
int position;
char* charpos;
};
int main(void) {
NameCard manClerk("Lee", "ABCEng", "010-1111-2222", COMP_POS::CLERK);
NameCard copy1 = manClerk;
NameCard manSENIOR("Hong", "OrangeEng", "010-3333-4444", COMP_POS::SENIOR);
NameCard copy2 = manSENIOR;
NameCard manAssist("Kim", "SoGoodComp", "010-5555-6666", COMP_POS::ASSIST);
manClerk.ShowNameCardInfo();
copy1.ShowNameCardInfo();
manSENIOR.ShowNameCardInfo();
copy2.ShowNameCardInfo();
manAssist.ShowNameCardInfo();
return 0;
}
결과는 뜨는데 저렇게 오류가 뜸
동적할당에서 오류나는거같은데 뭐 틀린거 있음??
댓글 0