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
>

Reply via email to