tailieunhanh - Module12 Exceptions, Templates, and Other Advanced Topics

An exception is an error that occurs at runtime. Using C++’s exception handling subsystem, you can, in a structured and controlled manner, handle runtime errors. When exception handling is employed, your program automatically invokes an error-handling routine when an exception occurs. The principal advantage of exception handling is that it automates much of the error-handling code that previously had to be entered “by hand” into any large program. | Module12 Exceptions Templates and Other Advanced Topics Table of Contents CRITICAL SKILL Exception CRITICAL SKILL Generic CRITICAL SKILL Generic CRITICAL SKILL Dynamic CRITICAL SKILL CRITICAL SKILL static Class CRITICAL SKILL Runtime Type Identification RTTI .46 CRITICAL SKILL The Casting You have come a long way since the start of this book. In this the final module you will examine several important advanced C topics including exception handling templates dynamic allocation and namespaces. Runtime type ID and the casting operators are also covered. Keep in mind that C is a large sophisticated professional programming language and it is not possible to cover every advanced feature specialized technique or programming nuance in this beginner s guide. When you finish this module however you will have mastered the core elements of the language and will be able to begin writing real-world programs. 1 C A Beginner s Guide by Herbert Schildt CRITICAL SKILL Exception Handling An exception is an error that occurs at runtime. Using C s exception handling subsystem you can in a structured and controlled manner handle runtime errors. When exception handling is employed your program automatically invokes an error-handling routine when an exception occurs. The principal advantage of exception handling is that it automates much of the error-handling code that previously had to be entered by hand into any large program. Exception Handling Fundamentals C exception handling is built upon three keywords try catch and throw. In the most general terms program statements that you want to monitor for exceptions are contained in a try block. If an exception that is an error occurs within the try block it is thrown using throw . The exception is caught using catch and processed. The following discussion elaborates upon this general description. Code that you

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG