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
Iblesoft
 
Exception handling and templates
Exception handling and templatesException handling and templates
Exception handling and templates
farhan amjad
 
Itp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & AssertionsItp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & Assertions
phanleson
 
Exception Handling
Exception HandlingException Handling
Exception Handling
Alpesh Oza
 

Was ist angesagt? (18)

Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
Interface andexceptions
Interface andexceptionsInterface andexceptions
Interface andexceptions
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling and templates
Exception handling and templatesException handling and templates
Exception handling and templates
 
Itp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & AssertionsItp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & Assertions
 
$Cash
$Cash$Cash
$Cash
 
Exception handling
Exception handlingException handling
Exception handling
 
Comp102 lec 10
Comp102   lec 10Comp102   lec 10
Comp102 lec 10
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Exceptions
ExceptionsExceptions
Exceptions
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Exceptions in c++
Exceptions in c++Exceptions in c++
Exceptions in c++
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
 
12 exception handling
12 exception handling12 exception handling
12 exception handling
 
Exceptions
ExceptionsExceptions
Exceptions
 
Training material exceptions v1
Training material   exceptions v1Training material   exceptions v1
Training material exceptions v1
 

Andere mochten auch (14)

Personal presentation
Personal presentationPersonal presentation
Personal presentation
 
Slideshare Presentation For Social Media
Slideshare Presentation For Social MediaSlideshare Presentation For Social Media
Slideshare Presentation For Social Media
 
I frame app guide
I frame app guideI frame app guide
I frame app guide
 
The world of writers
The world of writersThe world of writers
The world of writers
 
Social games & mmo
Social games & mmoSocial games & mmo
Social games & mmo
 
Sevakriti
SevakritiSevakriti
Sevakriti
 
About Me Presentation
About Me PresentationAbout Me Presentation
About Me Presentation
 
Matter powerpoint
Matter powerpointMatter powerpoint
Matter powerpoint
 
Week7 exception handling
Week7 exception handlingWeek7 exception handling
Week7 exception handling
 
韩国Ppt高手收集的ppt图表素材[免积分下载]
韩国Ppt高手收集的ppt图表素材[免积分下载]韩国Ppt高手收集的ppt图表素材[免积分下载]
韩国Ppt高手收集的ppt图表素材[免积分下载]
 
New how to
New how toNew how to
New how to
 
How to ppt
How to pptHow to ppt
How to ppt
 
New how to3
New how to3New how to3
New how to3
 
New how to10
New how to10New how to10
New how to10
 

Ähnlich wie Week7 exception handling

Vc++ 4(exception handling)
Vc++ 4(exception handling)Vc++ 4(exception handling)
Vc++ 4(exception handling)
Raman Rv
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
jigeno
 
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
 
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
 

Ähnlich wie Week7 exception handling (20)

UNIT III.ppt
UNIT III.pptUNIT III.ppt
UNIT III.ppt
 
UNIT III (2).ppt
UNIT III (2).pptUNIT III (2).ppt
UNIT III (2).ppt
 
Vc++ 4(exception handling)
Vc++ 4(exception handling)Vc++ 4(exception handling)
Vc++ 4(exception handling)
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
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
 
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
 
What is Exception Handling?
What is Exception Handling?What is Exception Handling?
What is Exception Handling?
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
 
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
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
 
Exception handling
Exception handlingException handling
Exception handling
 
UNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and MultithreadingUNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and Multithreading
 

Kürzlich hochgeladen

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Kürzlich hochgeladen (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).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.