Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
A: C++, unlike only about every other language with exceptions, is extremely accomodating while it comes to what you can throw. Actually, you can throw anything you akin to. That begs the question then, what should you throw?
In general, it's best to throw objects, not built-ins. If achievable, you must throw instances of classes which derive (ultimately) from the std::exception class. Through making your exception class inherit (ultimately) from the standard exception base-class, you are making life simpler for users (they have the alternative of catching most things by std::exception), plus probably you are providing them with more information (as the fact that your particular exception might be a refinement of std::runtime_error or whatever).
The common practice is to throw temporary:
#include
class MyException : public std::runtime_error {
public:
MyException() : std::runtime_error("MyException") { }
};
void f()
{
// ...
throw MyException();
}
Here, a temporary of type MyException is created & thrown. Class MyException inherits from class std::runtime_error that (ultimately) inherits from class std::exception.
solution of problem based on poiter
What happens while a derived-class object is developed & destroyed? A: Space is allocated (on the heap or the stack) for the full object (i.e. adequate space to store the data m
What is the difference between early binding and late binding? What are advantages of early binding? a.) Late binding refers to function calls which aren't resolved until run t
basic salary of an employe.the allowence are House rent 20% of basic salary Medical allowence is 10% of basic salary conveyence allowence is 10% calculate anrd display gross salar
Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send
Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b
how to create the programs in c++ knowledge
Write a C program to compute the factorial of 5 i.e 1x2x3x4x5 etc #include stdio.h void main() { char promt; int factor; factor = 1*2*3*4*5; printf("The fac
Explain about the Constants in c language? The Constants in C refer to fixed values that don't change during the execution of a program. C has four fundamental types of constan
Hiding overloaded functions We cannot overload a base class function by redefining it in a derived class with a dissimilar argument list. Consider examples to see if similar fu
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!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd