[ns] How to pass object into handle() function?
Jack Wang
junw24 at hotmail.com
Thu Feb 12 15:26:28 PST 2004
Hi all:
Below is the description of my question.
I define my own timer and handle() function as below:
class My_Timer : public Handler {
public:
My_Timer(MyAgent* a) : agent(a) {}
void handle(MyAgent* b);
private:
Event intr;
};
void My_Timer::handle(MyAgent* b){
b->datda1 = 100;
b->datda2 = 2.8;
}
class MyAgent : public Agent{
friend class My_Timer;
public:
My_Timer mytimer;
int data1;
double data2;
void funct1();
}
void MyAgent::funct1(){
Scheduler::instance().schedule( mytimer, this, 10.0);
}
My expectation is to let My_Timer::handle(MyAgent* b) modify the data1 and
data2 of MyAgent after 10 seconds from current time.
Will it work? Any suggestion is appreciated.
Jack
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail
More information about the Ns-users
mailing list