Consider the following code:-
Code: Select all
interface reproduction
properties
type:string.
predicates
perform:().
end interface reproduction
class reproduction:reproduction end class
implement reproduction
facts
type:string:="UNDEFINED".
clauses
/*
The use of This keyword allows the general method of reproduction to behave differently for
ford different stages of reproduction -- which is great*/
perform():- stdio::write("The process being performed is ", This:type).
end implement reproduction
/*
***************************************************************/
interface fertilization supports reproduction end interface
class fertilization:fertilization end class
implement fertilization inherits reproduction
facts
type:string:="FERTILIZATION".
clauses
new():-reproduction::new().
end implement fertilization
/*
***************************************************************/
interface incubation supports reproduction end interface
class incubation:incubation end class
implement incubation inherits reproduction
facts
/*
I HAVE FORGOTTEN TO IMPLEMENT THE PROPERTY reproduction::type:string FOR THE
INCUBATION CLASS*/
clauses
new():-reproduction::new().
end implement incubation
/*
***************************************************************/
implement main
clauses
run():-
console::init(),
Process = incubation::new(),
Process:perform(),
console::readchar()=_.
end implement main
goal
mainExe::run(main::run).