Skip to content

What a constructor is for

A class has a constructor that validates its arguments and throws if they are wrong.

Why throw rather than record the problem and continue?