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

Re: [ns] creating an new protocol



On Friday 27 July 2001 16:17, Yang MinZhen wrote:

First, a request, please send only plain text to the mailing list, no 
HTML.

> class ECHO_Timer;

Forward declaration of class ECHO_Timer.  You can use pointers 
(ECHO_Timer*) but not objects (ECHO_Timer).  The class is not 
complete yet.

> class ECHO_Agent : public Agent {
> ....
> protected:
>   ECHO_Timer echo_timer_;

Trying to use an object of a class that you have not fully declared.  
Not allowed by C++.  Try using a pointer instead.

> }

Since you only use pointers to ECHO_Agent objects in ECHO_Timer, you 
should forward declare ECHO_Agent, then fully declare ECHO_Timer, 
then finish the class declaration for ECHO_Agent.

class ECHO_Agent;

class ECHO_Timer : public TimerHandler {
...
protected:
  ECHO_Agent* a_;
};

class ECHO_Agent : public Agent {
...
protected:
  ECHO_Timer echo_timer_;
};

-- 
Brian Lee Bowers	|	RADIANT Team (Summer Intern)
[email protected]	|	Los Alamos National Laboratory