Question: 2-1. Define and implement a class named cart. A cart object represents a horse drawn cart that can seat up to four meerkats, after that
2-1. Define and implement a class named cart. A cart object represents a horse drawn cart that can seat up to four meerkats, after that meerkats have to walk. The meerkats must be represented by meerkat objects. The cart class has the following constructors and behaviours: cort)i bool addleerkat(meerkat cat); vold enptyCort() void printMeerkats0 // create an erpty cart object // dd, ?"eerkat to the cart, returns false if full // renove all reerkats from the core print the nane, space,the age, then a new line for eech seerkat in the order they were added Your main program should create a cart object and 5 meerkat objects. The cart object is initially empty. Your main program must then add all 5 meerkat objects to the cart object. An appropriate error message must be printed by your main program when the cart is full
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
