Path: utzoo!utgpu!news-server.csri.toronto.edu!helios.physics.utoronto.ca!ists!yunexus!geac!becker!pantor!richard From: richard@pantor.UUCP (Richard Sargent) Newsgroups: comp.lang.c++ Subject: virtual and overloading Message-ID: <58.UUL1.3#5109@pantor.UUCP> Date: 20 Mar 90 14:41:40 GMT Organization: Pansophic Systems Inc, Graphics Product Company Lines: 35 (I apologize if this has made it out before. I have not seen any indication that it has done so, hence the repost.) A question came up recently here as to what is correct code for a C++ 2.0 program. We have a derived tree of classes of graphical objects, with the base class defining a 'virtual void draw( some *obj )'. In one derived class, a way down the tree of classes, we have a class in which we want to have a function 'void draw( void )'. That is, we want a function for that particular class which takes no argument. Attempting to do this the obvious way results in a type mismatch. Q: is it necessary that the base class define 'virtual void draw( void )' to overload it, even though the only class to use it is way down the tree of classes? If we do this then we get an error message on the derived classes which define 'void draw( some *obj )', namely "sorry, not implemented: virtual derclass::draw() overloaded in base class but not in derived class". So, does this mean that we have to specify the overloading of the 'void draw( void )' in all derived classes? Q: exactly what do we need to do to make this work? If anyone has done something like this in 2.0, we certainly would appreciate hearing how? Thanks for your help. Richard Sargent Internet: richard@pantor.UUCP Systems Analyst UUCP: ...!mnetor!becker!pantor!richard