Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'thinking in c plus plus(p17)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | much further. A complicated container-class library may cover all sorts of additional issues including multithreading persistence and garbage collection. Exercises Solutions to selected exercises can be found in the electronic document The Thinking in C Annotated Solution Guide available for a small fee from www.BruceEckel.com. 1. Implement the inheritance hierarchy in the OShape diagram in this chapter. 2. Modify the result of Exercise 1 from Chapter 15 to use the Stack and iteratorin TStack2.hinstead of an array of Shape pointers. Add destructors to the class hierarchy so you can see that the Shape objects are destroyed when the Stack goes out of scope. 3. Modify TPStash.hso that the increment value used by inflate can be changed throughout the lifetime of a particular container object. 4. Modify TPStash.hso that the increment value used by inflate Automatically resizes itself to reduce the number of times it needs to be called. For example each time it is called it could double the increment value for use in the next call. Demonstrate this functionality by reporting whenever an inflate is called and write test code in main 5. Templatize the fibonacci function on the type of value that it produces so it can produce long float etc. instead of just int . 6. Using the Standard C Library vector as an underlying implementation create a Set template class that accepts only one of each type of object that you put into it. Make a nested iteratorclass that supports the end sentinel concept in this chapter. Write test code for your Set in main and then substitute the Standard C Library set template to verify that the behavior is correct. 780 Thinking in C www. BruceEckel .com 7. Modify AutoCounter.hso that it can be used as a member object inside any class whose creation and destruction you want to trace. Add a string member to hold the name of the class. Test this tool inside a class of your own. 8. Create a version of OwnerStack.lithat uses a Standard C Library vector as