stop creation

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello,
I have as class and when I get wrong data when creating the object (in the
'new' routine) I want to break off the creation of the classObject, so it
results in 'nothing' to the creator . How can I do that?
Thanx
Frank
 
Frank said:
Hello,
I have as class and when I get wrong data when creating the object
(in the 'new' routine) I want to break off the creation of the
classObject, so it results in 'nothing' to the creator . How can I do
that? Thanx
Frank

Catch the error in the procedure creating the object.
Optionally/Additionally add a shared function to the class creating the
object and returning Nothing if an exception was thrown.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* "Frank said:
I have as class and when I get wrong data when creating the object (in the
'new' routine) I want to break off the creation of the classObject, so it
results in 'nothing' to the creator . How can I do that?

Throw an exception in the ctor. Alternatively, you can provide a shared
method that returns an object of the class' type or 'Nothing' if
creation fails.
 
Herfried K. Wagner said:
Throw an exception in the ctor. Alternatively, you can provide a
shared method that returns an object of the class' type or 'Nothing'
if creation fails.

Good suggestion! ;-)
 
Back
Top