We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Usually if you need your own exception class you need a ctor to customize the what message. It's not common throw lots of times the same exception with the same message. It's more common throw the same exception with different messages.
In c++11 or c++14 {} is used for construct objects. In the case before is the same. Look at vector constructor vector<int> vec1(7, 10); initialize 7 elements to 10 value. vector<int> vec1{7, 10}; instead create a vector with two elements 7 and 10.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 17: More Exceptions
You are viewing a single comment's thread. Return to all comments →
Usually if you need your own exception class you need a ctor to customize the what message. It's not common throw lots of times the same exception with the same message. It's more common throw the same exception with different messages.
In c++11 or c++14
{}
is used for construct objects. In the case before is the same. Look at vector constructorvector<int> vec1(7, 10);
initialize 7 elements to 10 value.vector<int> vec1{7, 10};
instead create a vector with two elements 7 and 10.