Compiler Grabs Wrong Overload

I have a class that contains two different versions of the same function called GetZip().  In one version, it uses CStrings that are themselves pointed to controls, in the other, it uses the controls themselves.

The two are declared thus:

int GetZip(CDialog *pParent,struct dbffile *amaf08z,CString *pCity, CString *pState, CString *zip);
int GetZip(CDialog *pParent,struct dbffile *amaf08z, CCapEdit *pCtrlCity, CStateCombo *pCtrlState, COXMaskedEdit *pCtrlZip);

where CCapedit is a control derived from CEdit, CStateCombo is derived from CComboBox, and COXMaskedEdit is a third party Masked Editor derived from CEdit.

The call that accesses the  controls directly is used throughout the program in various dialogs, and works, as advertised, except in one case where the compiler insists on latching onto the one that uses CStrings.

Since I have both versions to work with, it is easy enough to rewrite the call to use the variables rather than the controls, but what is going on here?  I am very concerned that I have some issues that need to be dealt with now in the proper fashion, rather than just designing a work-around.

1.  I thought about an errant header file, and there is only one header on the system where GetZip in mentioned.
2.  I thought that perhaps name mangling is the culprit (A CString looks like a Control to the name mangler), but I can't find any way to view the name mangled output.  Something like -P or -E in a traditional 'c' compiler.  If this is the case, why would it work elsewhere in the same program, albiet a different source file?
3.  In this source file, the (I think they are called tooltips) window that comes up after the first '(' knows that both instances are available.  As a matter of fact, the overload that uses controls is the first one mentioned.

Any help that you can offer will be greatly appreciated.

Thanks in advance, Rick



rickatseasoftAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WelkinMazeCommented:
Is there enough information in your calls of the functions for the compiler to recognize the passed parameters. Maybe it treats them just as pointers?
0
PockyMasterCommented:
If you explicitly cast your variables in your call, will it still go the wrong way?
0
jkrCommented:
Can you post the code in question?

>>but I can't find any way to view the name mangled output.

Set the linker to generate a map file, you'll find the mangled name there.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.