| __ |
--
--^ Generic Animal Object
--
property bloodTemp, favouriteSound, myName, mySpecies
on birth me
set the myName of me = ""
return me
end
on reportSound me
alert "The noise I make is" && QUOTE & the favouriteSound of me & QUOTE
end
on reportTemp me
--^ show an alert describing your blood temperature
case (the bloodTemp of me) of
#warm:
set tmpBlood = "warm"
#cold:
set tmpBlood = "cold"
otherwise
set tmpBlood = "unknown temperature"
end case
alert "My blood is" && tmpBlood
end
on reportWho me
--^ show an alert giving your species and (if possible) name
-- "" is default value, set at birth of animal
if the myName of me <> "" then
alert "I'm a" && speciesOf(me) && "called" && nameOf(me)
else
alert "I'm a" && speciesOf(me) && "with no name."
end if
end
-- two accessor routine for internal variables
on nameOf me
return the myName of me
end
on speciesOf me
return the mySpecies of me
end
|