Set - 5

Question 11 :

How does throwing and catching exceptions differ from using setjmp and longjmp?

Answer :

The throw operation calls the destructors for automatic objects instantiated since entry to the try block.


Question 12 :

What is a default constructor? 

Answer :

Default constructor WITH arguments 

class B { public: B (int m = 0) : n (m) {} int n; }; int main(int argc, char *argv[]) { B b; return 0; }

 


Question 13 :

What is a conversion constructor? 

Answer :

A constructor that accepts one argument of a different type.


Question 14 :

What is the difference between a copy constructor and an overloaded assignment operator? 

Answer :

A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.


Question 15 :

When should you use multiple inheritance? 

Answer :

There are three acceptable answers: "Never," "Rarely," and "When the problem domain cannot be accurately modeled any other way."