纯新手学习语法糖,装*用,没啥实际用途
C++ 代码
using namespace std;
class ParkingSystem {
private:
int car[4];
public:
ParkingSystem(int big, int medium, int small) {
car[1] = big; car[2] = medium; car[3] = small;//建议分开写
}
bool addCar(int carType) {
return car[carType]-- >0;
}
};