SlideShare uma empresa Scribd logo
1 de 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++

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
ashishpaul799
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Último (20)

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
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
 
[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
 
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
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.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...
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 

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.