This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problem with virtual functions


Here is the class definition:

#ifdef __GNUG__
#pragma interface
#endif

class StateFile;
class Interface;
class ostream;

class GTracker {
public:
  GTracker();
  virtual ~GTracker() ;

  virtual void set_state(StateFile& statefile, Interface *interface) ;
  virtual void write_state(ostream& s) ;

  virtual void set_defaults() ;

  virtual void reset() ;

  virtual void step_once(int field, int nfields) ;

  virtual void display() ;
};

I use this class as pure virtual.
Still, I have defined function bodies for each function in a seperate cc-file.
The constructor and destructor bodies are both empty,  the other functions cout the string "not implemented".
 

Alexandre Oliva wrote:

On May 17, 2001, vok@cfar.umd.edu wrote:

> Wouldn't the compiler refer explicitely to the undefined method, if something
> like that happens?

It would refer to it in the virtual table, but the virtual table
didn't get defined because of that.

Care to post the definition of class GTracker?

--
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

-- 
Volker Krüger              |\ |\ |\   Center For Automation Research, Rm# 4465
University of Maryland     | \| \| \   phone: +1 (301) 405-1756  fax: 314-9115
A. V. Williams Building    |  |  |  \   url:      http://www.cfar.umd.edu/~vok
College Park, MD 20742     |__|__|___\   email:               vok@cfar.umd.edu 
******************         PGP key available          ************************
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]