Re: Properties in Methodica
Mike Nelson wrote:
> After carefully reviewing Derek's second post, I have tried my hand at
> creating
> a good readable syntax for defining properties.
Thanks Mike. It is looking good.
I take it that the 'value' parameter for the setter method is a reserved word in
that context and is a Euphoria object datatype. That would mean that the setter
could receive a sequence and deal with as required.
property integer height
public get
return this.h
public set
if sequence(value) then
value = toInteger(value)
end if
if value<0 then
throw Type_Error("Height must not be negative.")
else
this.h=value
end if
end property
foo.height = "23"
--
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell
|
Not Categorized, Please Help
|
|