Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3695

Constructor to create nil object

$
0
0

I have a situation where I’d like a new object not to be created when the constructor parameters fail to meet certain conditions. I realize that the object has already been created when the constructor method is called. So is it possible for the constructor to delete (destruct) the object so that the object becomes nil?

In my main program I’d like to be able to do this:

var myObj as new objType(SomeParameters)
if IsNull(myObj) then
  'Take remedial action when SomeParameters are bad
end if

Reason why I want to do this is that it’s less cumbersome for the constructor to check the validity of the input parameters than for the calling program to do it.

10 posts - 8 participants

Read full topic


Viewing all articles
Browse latest Browse all 3695

Trending Articles