C++ Programming Ch.8 Exercise 5 Solution
Problem: λ¬Έμ 5~6μ μ μ©λλ BaseArray ν΄λμ€λ λ€μκ³Ό κ°λ€. 1 2 3 4 5 6 7 8 9 10 11 12 class BaseArray { int capacity; // λ°°μ΄μ ν¬κΈ° int *mem; // μ μ λ°°μ΄μ λ§λ€κΈ° μν λ©λͺ¨λ¦¬μ ν¬μΈν° protected: // μμ±μκ° protected BaseArray(int capacity=100){ this->capacity = capacity; mem = new int [capacity]; } ~BaseArray() { delete [] mem; } void put(int index, int val) { mem[index] = val; } int get(int index) { return mem[index]; } int getCapacity() { return capacity; } }; BaseArrayλ₯Ό μμλ°μ νμ²λΌ μλνλ MyQueue ν΄λμ€λ₯Ό μμ±νλΌ. ...