can i have an example, please?
I have to write classes to implement an inventory list simulation for a bookstore. i don't really know how to start the store class. can some give me an example of a store class and types of functions that may go in that class?
Here are some of the requirements for it:
Write a class called Store (filenames are store.h and store.cpp). A Store object should contain at least the following information: the amount of money in the store cash register and a book inventory list. There is no size limit to the inventory list, so it should be implemented with a dynamically allocated array. (This means you'll need an array of Book objects). You can add any public or private functions into the Store class that you feel are helpful. In addition to the Store class itself, you will also create a menu program to manage the inventory of books. However, the Store class will be able to do much of the work, as the Store member functions will be the interface between the menu program and the internally stored data (cash register and list of books).
Rules for the Store class:
All member data of class Store must be private
There should be no cin statements inside the Store class member functions. To ensure the class is more versatile, any user input (i.e. keyboard) described in the menu program below should be done in the menu program itself. Design the Store class interface so that any items of outside information are received through parameters of the public member functions.
The list of Books must be implemented with a dynamically allocated array. There should never be more than 5 unused slots in this array (i.e. the number of allocated spaces may be at most 5 larger than the number of slots that are actually filled with real data). This means that you will need to ensure that the array allocation expands or shrinks at appropriate times. Whenever the array is resized, print a message (for testing purposes) that states that the array is being resized, and what the new size is.
Example: "** Array being resized to 10 allocated slots".
Since dynamic allocation is being used inside the Store class, an appropriate destructor must be defined, to clean up memory. The class must not allow any memory leaks