A Complete Guide to Programming in C++ part 61

A Complete Guide to Programming in C++ part 61. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | EXERCISE 579 Exercise Modify and complete the definition of the class InhomList which represents an inhomogeneous list. Write the destructor for the InhomList destructor releases the memory occupied by the remaining list elements. Implement the getPrev method and both versions of the insert and insertAfter algorithm needed for inserting list elements was described in the section Implementing an Inhomogeneous List. Implement the displayAll method which walks through the list sequentially outputting each element. Test insertion and output of list elements. Check whether the comments on the objects are output if present. Define the getPos method which locates the position of an element to be deleted. If the element is in the list its address is returned. Otherwise a NULL pointer is returned. Write the erasePos method which deletes a list element at a given position. Pay attention to whether the element to be deleted is the first or any other element in the list. Since the destructor for Cell was declared virtual only one version of the deletePos method is necessary. Define the erase method which deletes a list element with a given name from the list. Test deletion of list elements. Continually display the remaining elements in the list to be certain. Now implement the copy constructor and assignment. Use the insert to construct the list calling the applicable version of the can call the typeid operator to ascertain the type of the list element currently to be operator is declared in the header file typeinfo. Example if typeid ptr typeid DerivedEl . The expression is true if ptr references a DerivedEl type object. Then test the copy constructor and the assignment 580 CHAPTER 26 ABSTRACT CLASSES SOLUTION --------------------------------------------------------- Defines the classes Cell BaseEl and DerivedEl. --------------------------------------------------------- ifndef _CELL_ define _CELL_ include string include .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.