How do I write a ctor definition which has both throw and a member initialisation list?
Is this correct?
ClassName::ClassName(int parameter): datamember_(parameter) throw(ExceptionType)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
throwthing is part of the function declarator, therefore it should appear before the initialization list (the:).BTW, exception specification is deprecated in C++0x, and except
throw()it is generally useless. See Should I use an exception specifier in C++?.