general begintemplate external objectvar public endtemplate new objrefSee Object Oriented Programming in the reference manual.
ObjectOrientedProgramming
begintemplate
begintemplate
and endtemplate
declarations. Classes are instantiated with
the new statement.
will print "Hello" to the screen.begintemplate String public s strdef s proc init() { if (numarg()) { s = $s1 } } endtemplate String objref s s = new String("Hello") print s.s
ObjectOrientedProgramming
endtemplate
ObjectOrientedProgramming
objectvar
ObjectOrientedProgramming
objref
o1 = o2
merely states that o1 and o2 are labels for the same object. Objects are
created with the new
statement. When there are no labels for an object
the object is deleted. The keywords objectvar
and objref
are synonyms.
An object has a unique name that can be determined with the print obj
statement
and consists of the template name followed by an index number in brackets.
This name can be used in place of an objref.
creates a vector object and a graph object with pointers named vec and g, respectively.objref vec, g vec = new Vector(20) g = new Graph()
ObjectOrientedProgramming
public
ObjectOrientedProgramming
external
global_ra = 100 func ra_value() {return global_ra} begintemplate Cell external ra_value create axon proc init() { forall Ra = ra_value() /* just the axon */ } endtemplate Cell
If needed, this can be expanded to allow other kinds of variables to be external. execute1 can be used to obtain external information as well.
ObjectOrientedProgramming
objectvariable = new Object(args)
creates a vector of size 30 with its pointer namedobjref vec vec = new Vector(30)
vec
.