[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions!




Hello, 
    Thank you for your reminding. Actually, I did not pay attention to 
it. 
    However, if so, I am more confused. The error is:
...
rsvp-link.cc: In method `void RSVPChecker::give(class Packet *)':
rsvp-link.cc:61: call of overloaded `recv(Packet *&, int)' is ambiguous
object.h:51: candidates are: NsObject::recv(Packet *, const char *)
object.h:48:                 NsObject::recv(Packet *, Handler *)
...

    In the file "rsvp-link.cc", the program code is

....

void RSVPChecker::give(Packet *p) {
  /* Simply forward the packet as if there was no RSVP agent */
  target_->recv(p, 0);     /* This is the error line 61 */
}

......


    I am really anxious for this problem. I really do not know what I 
do wrong.

    In addition, in object.h, 

> >class NsObject : public TclObject, public Handler {
> > public:
> >	NsObject();
> >	virtual ~NsObject();
> >	virtual void recv(Packet*, Handler* callback = 0) = 0;
> >	// Monarch extn - used for logging reasons why the 
> >	// pkt is handed off (eg droptargets)
> >	virtual void recv(Packet* p, const char* s);
> >
> >....

   What is the use of the Handle "callback"? According to my 
understanding, it seems only one parameter Packet* should be enough, 
should not it?


    Perhaps, my knowledge on C++ is not good enough, I can not 
understand the use of the final "=0" in the line 
" virtual void recv(Packet*, Handler* callback = 0) = 0"


     Anxious for help,

     Sun Kai

    
> Two things might be going on.
> 
> First, `recv(Packet *&, int)' != either
> NsObject::recv(Packet *, const char *)
> or NsObject::recv(Packet *, Handler *)
> because of the reference (&).
> (Packet *& != Packet *).
> This explanation seems most probable to me.
> 
> Second, there might be confusion about the second argument.
> 
>    -John Heidemann
>