How to cater for missing input to a class
View Single Post
08-27-2009, 08:50 AM
Join Date: May 2009
No we are on the same page apologies i misunderstood you. I think what you are suggesting is exactly what i'm looking for. I can set default values for both variables as spaces in the class and throw an exception if either has a value of spaces when the class is called. If I pass in the variables when calling the class this will override the default values set in the class.
Next question - is throwing an exception in a constructor method bad practice as it leaves a half instantiated object?
View Public Profile
Send a private message to captainmerton
Find More Posts by captainmerton