All Questions
Tagged with initialization exceptions
3 questions
4
votes
2
answers
1k
views
Verifying Parameters in Constructor or Service
I was reading on this SO page about when to check parameters when constructing an object. The accepted answer suggests throwing the exception from the constructor so that an invalid object cannot be ...
14
votes
1
answer
3k
views
Is it fine to make a default constructor unusable?
Specifically asking about the default constructor
Given that the constructor initializes all the data for an object, if I create a class that can't be used without proper initialization, is it not ...
2
votes
1
answer
135
views
Data decoding initialization/Constructor error handling
I have a set of loadable data decoders for a specific type of data and a stream to read containing data. Now I want the program to select the correct decoder in a reliable way so I want to use a trial-...