게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
[본삭금] c++ c2664해결방법좀 알려주세요 ㅠㅠ
게시물ID : programmer_22302짧은주소 복사하기
작성자 : 안녕하세
추천 : 0
조회수 : 692회
댓글수 : 3개
등록시간 : 2018/04/15 22:32:29
옵션
  • 본인삭제금지
#include <iostream>
#include <cstring>
using namespace std;
class PermanentWorker
{
private:
 char name[100];
 int salary;
public:
 PermanentWorker(char *name, int money)
  :salary(money)
 {
  strcpy(this->name, name);
 }
 int GetPay() const
 {
  return salary;
 }
 void ShowSalaryInfo() const
 {
  cout << "name: " << name << endl;
  cout << "salary: " << GetPay() << endl << endl;
 }
};
class EmployeeHandler
{
private:
 PermanentWorker * empList[50];
 int empNum;
public:
 EmployeeHandler():empNum(0)
 {}
 void AddEmployee(PermanentWorker *emp)
 {
  empList[empNum++] = emp;
 }
 void ShowAllSalaryInfo() const
 {
  for (int i = 0; i < empNum; i++)
   empList[i]->ShowSalaryInfo();
 }
 void ShowTotalSalary() const
 {
  int sum = 0;
  for (int i = 0; i < empNum; i++)
   sum += empList[i]->GetPay();
  cout << "salary sum: " << sum << endl;
 }
 ~EmployeeHandler()
 {
  for (int i = 0; i < empNum; i++)
   delete empList[i];
 }
};
int main(void)
{
 EmployeeHandler handler;
 
 handler.AddEmployee(new PermanentWorker("KIM", 1000));            //c2664
 handler.AddEmployee(new PermanentWorker("LEE", 1500));           //c2664
 handler.AddEmployee(new PermanentWorker("JUN", 2000));           //c2664
 handler.ShowAllSalaryInfo();
 handler.ShowTotalSalary();
 return 0;
}
 
 메인함수에 저 세줄에서 c2664가 뜹니다
 
심각도 코드 설명 프로젝트 파일 줄 비표시 오류(Suppression) 상태
오류 C2664 'PermanentWorker::PermanentWorker(PermanentWorker &&)': 인수 1을(를) 'const char [4]'에서 'char *'(으)로 변환할 수 없습니다. 
 
라고 하는데 프로젝트 속성에서 유니코드 문자집합설정을 멀티바이트 문자집합설정으로 바꾸어도 같은 에러가 발생하는데
해결방법좀 알려주세요 ㅠㅠㅠ
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호