SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Exception Handling in C++
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Exception Handling in C++ ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Fundamental Philosophy ,[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Traditional Exception Handling ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++ Note:– In most large systems, code to  handle errors and exceptions represents >80% of the total code of the system
Fundamental Philosophy  (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Fundamental Philosophy  (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Fundamental Philosophy  (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Class  exception ,[object Object],[object Object],[object Object],Exception Handling in C++
Example: Handling an Attempt to Divide by Zero Exception Handling in C++
Exception Handling in C++ Zero Divide Example ,[object Object],[object Object]
Exception Handling in C++ Zero Divide Example ,[object Object],[object Object]
try  Blocks ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Software Engineering Observation ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Catch   Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Catch  Handlers  (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++ All other classes of exceptions are not handled here catch  clauses attempted in order; first match wins!
Common Programming Errors ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Fundamental Philosophy  (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++ Control  does not  return to throw point
Stack Unwinding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Observations ,[object Object],[object Object],[object Object],Exception Handling in C++
Throwing an Exception ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Notes ,[object Object],[object Object],Exception Handling in C++
When to Use Exception Handling ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++ Don’t use for routine stuff such as end-of-file or null string checking
Software Engineering Notes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Rethrowing an Exception ,[object Object],[object Object],[object Object],Exception Handling in C++
Common Programming Error ,[object Object],[object Object],Exception Handling in C++ See D&D Fig 27.3
Exception Specifications ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++ Optional!
Exception Specifications (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Error Note ,[object Object],[object Object],[object Object],Exception Handling in C++
Constructors and Destructors ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Note ,[object Object],[object Object],Exception Handling in C++
Exceptions and Inheritance ,[object Object],[object Object],[object Object],Exception Handling in C++
Failure of calls to  new ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Standard Library Exception Hierarchy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Fig. 27.11  | Standard Library exception classes.  Exception Handling in C++
Exception Handling Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Exception Handling in C++
Exception Handling Summary  (continued) ,[object Object],[object Object],[object Object],[object Object],Exception Handling in C++

Weitere ähnliche Inhalte

Was ist angesagt?

Exception Handling
Exception HandlingException Handling
Exception Handling
Alpesh Oza
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
jigeno
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
Deepak Sharma
 
EXCEPTION HANDLING in C++
EXCEPTION HANDLING in C++EXCEPTION HANDLING in C++
EXCEPTION HANDLING in C++
Prof Ansari
 

Was ist angesagt? (20)

Exception Handling
Exception HandlingException Handling
Exception Handling
 
What is Exception Handling?
What is Exception Handling?What is Exception Handling?
What is Exception Handling?
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Exception handling
Exception handlingException handling
Exception handling
 
Exceptions in c++
Exceptions in c++Exceptions in c++
Exceptions in c++
 
C++ ala
C++ alaC++ ala
C++ ala
 
Exception Handling in the C++ Constructor
Exception Handling in the C++ ConstructorException Handling in the C++ Constructor
Exception Handling in the C++ Constructor
 
Handling Exceptions In C & C++[Part A]
Handling Exceptions In C & C++[Part A]Handling Exceptions In C & C++[Part A]
Handling Exceptions In C & C++[Part A]
 
Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++
 
Exception handling c++
Exception handling c++Exception handling c++
Exception handling c++
 
Understanding Exception Handling in .Net
Understanding Exception Handling in .NetUnderstanding Exception Handling in .Net
Understanding Exception Handling in .Net
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
 
Presentation1
Presentation1Presentation1
Presentation1
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
 
Best Practices in Exception Handling
Best Practices in Exception HandlingBest Practices in Exception Handling
Best Practices in Exception Handling
 
EXCEPTION HANDLING in C++
EXCEPTION HANDLING in C++EXCEPTION HANDLING in C++
EXCEPTION HANDLING in C++
 
Exception Handling Java
Exception Handling JavaException Handling Java
Exception Handling Java
 
Exception Handling In Java
Exception Handling In JavaException Handling In Java
Exception Handling In Java
 

Ähnlich wie Week7 exception handling

Vc++ 4(exception handling)
Vc++ 4(exception handling)Vc++ 4(exception handling)
Vc++ 4(exception handling)
Raman Rv
 
9781439035665 ppt ch11
9781439035665 ppt ch119781439035665 ppt ch11
9781439035665 ppt ch11
Terry Yoast
 
Md07 exceptions&assertion
Md07 exceptions&assertionMd07 exceptions&assertion
Md07 exceptions&assertion
Rakesh Madugula
 

Ähnlich wie Week7 exception handling (20)

Exceptions overview
Exceptions overviewExceptions overview
Exceptions overview
 
UNIT III (2).ppt
UNIT III (2).pptUNIT III (2).ppt
UNIT III (2).ppt
 
UNIT III.ppt
UNIT III.pptUNIT III.ppt
UNIT III.ppt
 
Vc++ 4(exception handling)
Vc++ 4(exception handling)Vc++ 4(exception handling)
Vc++ 4(exception handling)
 
Interface andexceptions
Interface andexceptionsInterface andexceptions
Interface andexceptions
 
Exception handling
Exception handlingException handling
Exception handling
 
Chap12
Chap12Chap12
Chap12
 
Z blue exception
Z blue   exceptionZ blue   exception
Z blue exception
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Introduction of exception in vb.net
Introduction of exception in vb.netIntroduction of exception in vb.net
Introduction of exception in vb.net
 
9781439035665 ppt ch11
9781439035665 ppt ch119781439035665 ppt ch11
9781439035665 ppt ch11
 
130410107010 exception handling
130410107010 exception handling130410107010 exception handling
130410107010 exception handling
 
Md07 exceptions&assertion
Md07 exceptions&assertionMd07 exceptions&assertion
Md07 exceptions&assertion
 
Java unit 11
Java unit 11Java unit 11
Java unit 11
 
$Cash
$Cash$Cash
$Cash
 
$Cash
$Cash$Cash
$Cash
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
 
Exception handling
Exception handlingException handling
Exception handling
 
Java SE 11 Exception Handling
Java SE 11 Exception HandlingJava SE 11 Exception Handling
Java SE 11 Exception Handling
 
MODULE5_EXCEPTION HANDLING.docx
MODULE5_EXCEPTION HANDLING.docxMODULE5_EXCEPTION HANDLING.docx
MODULE5_EXCEPTION HANDLING.docx
 

Kürzlich hochgeladen

Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
SaadHumayun7
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Kürzlich hochgeladen (20)

Behavioral-sciences-dr-mowadat rana (1).pdf
Behavioral-sciences-dr-mowadat rana (1).pdfBehavioral-sciences-dr-mowadat rana (1).pdf
Behavioral-sciences-dr-mowadat rana (1).pdf
 
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 

Week7 exception handling

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Example: Handling an Attempt to Divide by Zero Exception Handling in C++
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Fig. 27.11 | Standard Library exception classes. Exception Handling in C++
  • 37.
  • 38.