> Is it possible to not return an instance of a class from its  
> constructor?
>
> For example, say my constructor for SomeClass is:
>
> Sub Constructor(rs As RecordSet)
>   dim d As Date
>   dim fld As DatabaseField
>
>   fld = rs.Field("EntryDate")
>   if fld = nil Then Return
>
>   // assign values to class properties
>
> End Sub
>
> Instead of returning a useless instance of SomeClass with none of its
> properties filled to the method that called the constructor, it would
> be nice if it were possible to return a nil object. Is it possible to
> do that?

You can do this the cocoa way:

dim c as class1
c = new class1
c = c.Init
// .Init may return nil

In Cocoa, you can do this on one line, but it's still possible in RB,  
just not as stylish. Cocoa does it like this:

MyNSClass* Result = [[bla alloc] init];

--
http://elfdata.com/plugin/
"String processing, done right"


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to