Design and implement an inventory system to manage different types of wearable tech products using inheritance and polymorphism.
See the course web page lab5 for the full directions.
- Toni Wu
- Dhruvam Desai
testDevices stores different Wearable devices in a vector of Wearable device type. This vector implements polymorphism as it allows for and stores child types of different types including FittnessTracker, SmartWatch, and ARGlasses. It also uses a for loop to traverse the objects in the vector calling their getInfo method. Here, the getInfo method is virtual in the Wearable device class and subsequently overridden in each child class. Each child class also takes advantage of protected members in Wearable device class to pull base information of each device by accessing those variables. Overall, polymorphism allows the loop to run correctly utilizing different objects and different versions of getInfo method to print all information of each object.