I have a check that does something like this:
if theObject:IsNull('myProperty') then ......
But it fails if theObject does not have the property given. I can fix that by adding a check: if theObject:Has('myProperty') and theObject:IsNull('myProperty'), but if I want to override the method IsNull and add the Has() method into the IsNull, how to do that? Is there better way of doing this?
//Geir Otto
class TheNewObjectClass inherits TheObjectClass:
method public override logical IsNull(propertyName as character):
if (not this-object:Has(propertyName) then
return true.
return super:IsNull(propertyName).
end method.
end class.
// assuming TheObjectClass is the class theObject is an instance of (and isn't final).
// of course now you have to make sure that theObject is of type TheNewObjectClass
class TheNewObjectClass inherits TheObjectClass:
method public override logical IsNull(propertyName as character):
if (not this-object:Has(propertyName) then
return true.
return super:IsNull(propertyName).
end method.
end class.
// assuming TheObjectClass is the class theObject is an instance of (and isn't final).
// of course now you have to make sure that theObject is of type TheNewObjectClass