Question: 7. Consider the following code. Modify the classes to make sure the main() function compiles and runs without any error. (Hint: you should implement

7. Consider the following code. Modify the classes to make sure the main() function compiles and runs without any error. (Hint: you should implement 2 or 3 functions.) [ < < 15 min] [3pt] 1. #include 2. #include < cassert > 3. 4. class student { 5. private: 6. std::string name; 7. int id; 8. }; 9. 10. class bag { 11. 12. 13. 14. typedef student value_type; typedef std::size_t size_type; static const size_type CAPACITY = 30; 15. public: 16. void insert(const value_type & entry); 17. size_type size() { return used; } 18. 19. private: 20. 21. 22. }; value type data[CAPACITY]; size_type used; 1. int main(int argc, const char *argv[]) { 23456700 2. 3. 4. 5. 6. 7. 8. } bag a, b; student mySt; a.insert(mySt); bmySta; std::cout < < "Size of b is: < < b.size(); return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
