ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories >> Software >> Programming-Languages >> C++ >> C++-General
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
is throwing exception from a constructor not a good practice ?
 Question Submitted By :: Abhishek
I also faced this Question!!     Rank Answer Posted By  
 
  Re: is throwing exception from a constructor not a good practice ?
Answer
# 1
yes, because constructor does not throws an exception
 
Is This Answer Correct ?    0 Yes 1 No
Saranya
 
  Re: is throwing exception from a constructor not a good practice ?
Answer
# 2
Actualy though when an  object is created memory will b
allocated but the process of allocation of memory will be
complete only if conytructor is successfully invoked  so if
constructor  throws an exception memory will not be
allocated for that object.
 
Is This Answer Correct ?    0 Yes 0 No
Shwetha.v.g
 
 
 
  Re: is throwing exception from a constructor not a good practice ?
Answer
# 3
throwing exception from a constructor is not bad at all. It 
is actually advised to use exceptions when you fail to 
create your object properly due to any reason. In this case 
memory will not be allocated for the object and no 
destructor will be called.
 
Is This Answer Correct ?    0 Yes 0 No
Vikas Sood
 
 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
how can u create a doubly linked list with out using pointers?  1
What are the differences between a struct in C and in C++? Wipro4
How do you know that your class needs a virtual destructor? Lucent3
What is the Maximum Size that an Array can hold? Satyam31
Is there something that we can do in C and not in C++? Patni5
what is pulse code modulation? Wipro1
Explain the difference between 'operator new' and the 'new' operator? Lucent1
What happens if an exception is throws from an, object's constructor and object's destructor? Wipro1
what is an array  12
Implement strncpy  2
How many bit combinations are there in a byte? Intel7
How to avoid changing constant values? Symphony1
implement stack using stack.h headerfile functions Subex1
What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?  2
Can we use resume in error handling i.e. in the catch block Infosys3
How do you test your code? Microsoft3
Difference between Top down and bottom up approaches for a given project ? HP1
Definition of class?  10
write program for palindrome  2
What are advantages of C++ when comparing with C? HP3
 
For more C++ General Interview Questions Click Here 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com