Nabila,
To print the value, you may do something like puts [$myagent set myvar_] Cheers, Teerawat On 11/6/2007, "Nabila khedimi" <[EMAIL PROTECTED]> wrote: > >This is what I did, we can set a value to the variable like you did but how to >get its value, for printing for example > >> To: [EMAIL PROTECTED]; ns-users@ISI.EDU> Subject: Re: [ns] access to TCL >> instance variables> From: [EMAIL PROTECTED]> Date: Tue, 6 Nov 2007 08:13:30 >> -0800> > > Hi Nabila,> > First of all, you need to bind your OTcl class >> Agent/MyAgentOtcl to, for> example, MyAgent. Secondly, suppose you need to >> access variable my_var_> of class MyAgent. You need to bind this variable to >> the OTcl domain.> This can be done in the constructor:> > MyAgent:MyAgent()> >> {> bind("my_var_", &my_var_);> }> > Then you will be able to access varaible >> my_var_ from the OTcl domain:> > set myagent [new Agent/MyAgentOtcl]> >> $myagent set my_var_ 10> > Good Luck> Teerawat> > On 11/6/2007, "Nabila >> khedimi" <[EMAIL PROTECTED]> wrote:> > >> >> >Hi,How do we access instance >> variables of a c++ class in tcl code I tried thefolowing: set myagent [new >> Agent/MyAgentOtcl]# Set configurable parameters of MyAgent$myagent set >> my_var1_otcl 4$myagent set my_var2_otcl 3.14$myagent call-my-priv-funcset >> intvar 0set intvar [Agent/MyAgentOtcl my_var1_otcl] puts "my_var1_otcl = >> $intvar" I have had this:my_var1_otcl= my_var1_otclthe name instead of th >> value, what's the problem, neither set intvar $myagent my_var1_otcl works >> Thanks for helpnabila> >> >_________________________________________________________________> >Windows >> Live Hotmail and Microsoft Office Outlook together at last. Get it now.> >> >http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033> >> > >_________________________________________________________________ >Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! >http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews