What should one catch?, C/C++ Programming

Assignment Help:

A: By keeping along with the C++ tradition of "there's more than one method to do that" (translation: "give programmers options & tradeoffs so they can choose what's best for them in their situation"), C++ let you a variety of options for catching.

Ø  Catch by value.

Ø  Catch by reference.

Ø  Catch by pointer.

Actually, you have all the flexibility that you have in declaring function parameters, and the rules for whether a specific exception matches (that means will be caught by) a specific catch clause are almost accurately the same as the rules for parameter compatibility while calling a function.

Given all this flexibility, how do you choose what to catch? Simple: unless there's a good motive not to, catch by reference. Avoid catching by value, as that causes a copy to be made and the copy can have distinct behavior from what was thrown. Only under extremely special circumstances should you catch by pointer.

 


Related Discussions:- What should one catch?

Minimumshelf, Write a program that finds the minimum total number of shelve...

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

Program, write a program that adds all numbers from 1 to 200

write a program that adds all numbers from 1 to 200

Programing, #question. write a program number to alphabet in c++..

#question. write a program number to alphabet in c++..

C, how to learn programming skills

how to learn programming skills

Super ascii string checker, Program which can check the given string is su...

Program which can check the given string is super ascii or not

What is class definition, Class Definition The following is the general...

Class Definition The following is the general format of defining a class template: class tag_name                  {                    public  :               // Must

Explain the rules for overloading an operator, Rules for overloading an ope...

Rules for overloading an operator This summarizes the most significant points you need to know in order to do operator function overloading. The only operators you may o

Input, I want to take 1.1 as input but when I am declaring it as float the ...

I want to take 1.1 as input but when I am declaring it as float the output is given as 1.1000000

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd