October 1997
Intermediate to advanced
800 pages
20h 48m
English
| 1: | Design a Double class that overloads the division operator for Double objects and built-in types. Under what conditions should the division operator throw exceptions? |
| 2: | Implement the copy constructor and overloaded assignment operator in class FilePtr (Listing 13.18 on page 636). Follow the approach shown in auto_ptr (Listing 13.15 on page 627). What helper functions do you need? |
| 3: | Add FBadRead and FBadWrite exceptions to the FileError exception hierarchy in Listing 13.19 on page 636. Use the mycp.C program (Listing 13.20 on page 637) to test your solution and make it behave as follows.
$ mycp file1 file2 Unable to open file file1 for access "r" (File not readable or does not exist) $ mycp myfile /etc/passwd Unable to open ... |