[comp.lang.c++] FAQ ??

jk@cs.man.ac.uk (John Kewley ICL) (08/28/90)

	I am sure I have seen posts about this problem before, but I cannot
remember what the answer was.

	In the following code:

#include <stdio.h>

class base
{
public:
	void try(void){printf( "%d\n",42 );}
};

class deriv : public base
{
public:
	void try( int i ) {printf( "%d\n",i );}
};

main()
{
	base b;
	deriv d;

	b.try();	// A
	b.try(4);	// B
	d.try();	// C
	d.try(7);	// D
}

I get an error for B and C in Sun AT&T 2.0, C in g++ and I don't understand why
I get the problem with B, it seems innocent enough.
--
        J.K.
 
John M. Kewley, ICL, Wenlock Way, West Gorton, Manchester. M12 5DR
Tel:   (+44) 61 223 1301 X2138  Email: jk@r6.cs.man.ac.uk / jk@nw.stl.stc.co.uk