Forcing an overloaded function to call itself

P

PSN

Dear all,
I have the following scenerio ..

typedef enum _enReadAs
{
BIN,
DEC,
HEX
}enReadAs;

char* build_message(uint32 &size, bool initialize=false, unsigned char
ini_val=0); // Overload function 1
char* build_message(const char* pbinmsg, enReadAs read, uint32
*size); // Overload function 2

char* build_message(uint32 &size, bool initialize=false, unsigned char
ini_val=0)
{}

char* build_message(const char* pbinmsg, enReadAs read, uint32 *size)
{
switch(read)
{
case BIN:<<<<<<<<<<<<<<<<<
break;
case HEX:<<<<<<<<<<<<<<<<
break;
case DEC:
1. CONVERTS THE CHARACTER STRING
"pbinmsg" TO A HEX CHARACTER STRING, "phexstring"
2. calls: build_message(phexstring, HEX,
*size); // the problem is here !! the compiler thinks im calling the
second
//
overloaded function and complains that it is unable to convert the
first
//
parameter. How can i tell the compiler that im not calling the other
//
overloaded function but the same one.
}
}

ERROR MESSAGE:
Error 5 error C2664: 'unsigned char *binmsg::build_message(unsigned
int &,bool,unsigned char)' : cannot convert parameter 1 from 'const
char *' to 'unsigned int &'

How can I force calling the same overloaded function ???

Hope I was clear .. Please ask me for more information if you need
any !!!

Regards,
Prakash
 
P

PSN

Dear All ..
Sorry for the inconvenience .. The problem is solved !!

The problem was the third argument where I was supposed to pass an
unsigned integer pointer, in order to call the desired overloaded
function .. However, im passing an unsigned integer, which is making
it to believe that the other overloaded function is desired ...

Thanks for your time !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top