[gnu.g++] c++ question

jason@MTXINU.COM (Jason Venner) (05/16/89)

I have some code that operates on a class.

(it is actually a class (B)that as a private data element that is an
instance of a class (A)).

In the code, I want to call a member function of of A.
This is an overloaded function, and can be called with either a char
or a char*.

In Class B, I would like to call it sometimes with a char, and
sometimes with a Chars.  The code that does it is almost identical.

How can I do this in g++ with only one function.

I could do it with macro's, but that seems to be frowned upon in
G++ing circles.  


What I want is
     member put(char c)		{ return internal_magic_put( c ); };
     member put( char* s)	{ return internal_magic_put( c ); };
...

internal_magic_put( char or char* thing, thing is a char or thing is a
char* )
{

	A::put(thing);		// automagically the correct type
	passed
	if( is a char ) do x
	else
		do y
.....

Jason Venner
Jason@spar.stanford.edu
jason@mtxinu.com
jason@violet.berkeley.edu
jason@ucbviolet.bitnet
{...,ucbvax}!mtxinu!jason

tiemann@sun.com (Michael Tiemann) (09/07/89)

There is an updated etags program for C++ floating around in the GNU
world, but I don't know where it is.  Could whoever wrote it please
send it to me or to Doug Lea (dl@g.oswego.edu)?  I would like to have
it included in the libg++ distribution (which currently sources other
useful C++ support, such as a C++ mode for GNU Emacs).

Michael