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

Re: command function



On Thu, 18 Mar 1999, Chadi M. BARAKAT wrote:

: I used the same code but it doesn't work. In fact, in the Docs, the
: class Queue has a command function but in the code it doesn't. What I
: did is put my new functions in the "command" function of the class of
: the queue type I used (Drop-Tail). Here, I will be needed to add my new
: functions to the class of every queue type I use instead of adding them
: once to the parent class Queue.

ok, i've been playing around with this for a while now and figured out
what the problem is.

i implemented a `command' method for the Queue object, re-make-d it,
and...it didn't work. as you experienced, the Queue::command never got
called, but instead a call to Connector::command was made.

this is funny because in e.g. DropTail::command the last line is:

	return Queue::command(argc, argv);

however if you delete drop-tail.o (to force a recompile of
drop-tail.cc) and re-make the whole thing...it works.

i guess the problem is the following (i may well be wrong):
when drop-tail.cc is compiled the call Queue::command is resolved
(it's _not_ a virtual method) to Connector::command because a
Queue::command does not (yet) exist. so when you afterwards add a
Queue::command but don't recompile drop-tail.cc nothing changes.

hope this helps,
chris


 -----------------------------------------------------------------
  Christof Brandauer                        [email protected]
  Student of Applied Informatics                 
  Department of Computer Science, University of Salzburg, Austria
 -----------------------------------------------------------------