#include <iostream>

using namespace std;


class DY

{

private:

   friend class CW;

   int DYMoney;

public:

   DY(int money)

      : DYMoney(money) {}

   void stolenMoney()

   {

      DYMoney = 0;

   }

   void showMoney()

   {

      cout << "DY의 돈 : " << DYMoney << endl;

   }

};

class DYP : public DY

{

private:

   friend class CW;

   int DYPMoney = 2000;

public:

   DYP(int money)

      : DY(money) {}

   void stolenMoney2()

   {

      DYPMoney = 0;

   }

   void showMoney2()

   {

      cout << "DYP의 돈: " << DYPMoney << endl;

   }

};


class SY

{

private:

   friend class CW;

   int SYMoney;

public:

   SY(int money)

      : SYMoney(money) {}

   void stolenMoney()

   {

      SYMoney = 0;

   }

   void showMoney()

   {

      cout << "DY의 돈 : " << SYMoney << endl;

   }

};

class SYP : public SY

{

private:

   friend class CW;

   int SYPMoney = 3500;

public:

   SYP(int money)

      : SY(money) {}

   void stolenMoney2()

   {

      SYPMoney = 0;

   }

   void showMoney2()

   {

      cout << "SYP의 돈: " << SYPMoney << endl;

   }

};


class CW

{

private:

   int CWMoney = 0;

public:

   friend class DYP;

   friend class SYP;

   void takeMoney(DYP &take, SYP &take2)

   {

      cout << "CW:돈 얼마 있냐? DY랑 SY 순서대로 말해봐." << endl;

      int dy;

      cin >> dy;

      int sy;

      cin >> sy;

      if ((dy == 5000) && (sy == 7500))

         cout << "CW : 솔직하게 얘기 했으니까 봐줄게" << endl;

      else if ((dy == 5000) && !(sy == 7500))

      {

         cout << "CW : SY 거짓말치네. 돈 내놔." << endl;

         take2.stolenMoney();

         take2.stolenMoney2();

         CWMoney = 7500;

      }

      else if (!(dy == 5000) && (sy == 7500))

      {

         cout << "CW : DY 거짓말 치네. 돈내놔." << endl;

         take.stolenMoney();

         take.stolenMoney2();

         CWMoney = 5000;

      }

      else

      {

         cout << "CW : 둘다 거짓말하네. 둘다 돈 내놔." << endl;

         take2.stolenMoney();

         take2.stolenMoney2();

         take.stolenMoney();

         take.stolenMoney2();

         CWMoney = 12500;

      }

   }

   void showMoney()

   {

      cout << "CW의 돈 : " << CWMoney << endl;

   }

};


int main(void)

{

   DYP JDY(3000);

   SYP LSY(4000);

   CW HCW;

   HCW.takeMoney(JDY,LSY);

   JDY.showMoney();

   JDY.showMoney2();

   LSY.showMoney();

   LSY.showMoney2();

   HCW.showMoney();

}





여기 코드에서 각 class에서 private 부분에서 

(int DYPMoney = 2000; 이런부분) 여기서 이콜 즉 = 이부분에서 계속

"data member initializer is not allowed" 이러한 컴파일링 오류 메세지가 뜨거든요...

이거 왜이런건가요?? ㅠㅠ