#include<iostream> using namespace std; int main(){ DownCnt dcnt(2); return 0; } class DownCnt{ const int downVal=2; const int maxVal; int value; public: DownCnt(int inputVal) : maxVal(inputVal), value(inputVal){ void reSetCnt(){ value = maxVal; } void cnt(){ if(value <= 0){ cout << "계수가 0이되어 최대값 " << maxVal <<" 으로 돌아갑니다." << endl; reSetCnt(); }else{ cout << "계수가 " << downVal << " 감소합니다. 현재" << value << endl; value -= downVal; cout << "감소후의 값 : " << value << endl; } int getValue(){return value;} } };

 

대충 이렇게 만들었는데.

객체생성을 뙇 ! 할려고하는데 DownCnt 이녀석이 해당 범위를 벋어났다는겨..-ㅅ-

머가 문제인지점 파악해줘요 형들.