confused about execute()
Posted: Sat Feb 17, 2007 6:12 pm
When running the code (at the bottom), I get the following error:
I was hoping that using "this" as the second argument to execute() would make it unnecessary to declare the variable as public. Am I missing something?
Code: Select all
the_number_ten not a public member of Ten
/Users/benlhalt/NEURON/nrn/i686/bin/nrniv: Ten the_number_ten
in Ten.hoc near line 17
{print this.the_number_ten}
^
Ten[0].execute("print this.the_number_ten", Ten[0])
Ten[0].print_ten()
/Users/benlhalt/NEURON/nrn/i686/bin/nrniv: execute error: print this.the_number_ten
in Ten.hoc near line 17
^
Code: Select all
begintemplate Ten
public print_ten
objref this
proc init() {
the_number_ten = 10
}
proc print_ten() {
execute("print this.the_number_ten", this)
}
endtemplate Ten
objref my_ten
my_ten = new Ten()
my_ten.print_ten()