Click here to Skip to main content
15,907,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
Matthew Faithfull25-Feb-08 5:41
Matthew Faithfull25-Feb-08 5:41 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
George_George25-Feb-08 18:33
George_George25-Feb-08 18:33 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
Matthew Faithfull25-Feb-08 22:59
Matthew Faithfull25-Feb-08 22:59 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
George_George25-Feb-08 23:35
George_George25-Feb-08 23:35 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
Matthew Faithfull25-Feb-08 23:43
Matthew Faithfull25-Feb-08 23:43 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
George_George26-Feb-08 15:09
George_George26-Feb-08 15:09 
GeneralRe: Compiler Warning C4373 about virtual methods [modified] Pin
Rajkumar R26-Feb-08 3:11
Rajkumar R26-Feb-08 3:11 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
George_George26-Feb-08 15:13
George_George26-Feb-08 15:13 
Hi Rajkumar,


For your sample,

int myfunc (int a);
int myfunc (const int &a);


even if they are different, they will result in ambiguity in function call. Right? Here is my below code and related compile error message. So, is there any practical benefits to define them both?

int myfunc (int a) {return 100;}

int myfunc (const int &a) {return 200;}

int main()
{
	myfunc (100);
	return 0;
}


Compile errors
1>d:\visual studio 2008\projects\test_const5\test_const5\main.cpp(7) : error C2668: 'myfunc' : ambiguous call to overloaded function
1>        d:\visual studio 2008\projects\test_const5\test_const5\main.cpp(3): could be 'int myfunc(const int &)'
1>        d:\visual studio 2008\projects\test_const5\test_const5\main.cpp(1): or       'int myfunc(int)'
1>        while trying to match the argument list '(int)'



regards,
George
GeneralRe: Compiler Warning C4373 about virtual methods Pin
Rajkumar R26-Feb-08 19:24
Rajkumar R26-Feb-08 19:24 
GeneralRe: Compiler Warning C4373 about virtual methods Pin
George_George26-Feb-08 21:18
George_George26-Feb-08 21:18 
GeneralCasting ULARGE_INTEGER as FILETIME Pin
Ben Aldhouse25-Feb-08 2:07
Ben Aldhouse25-Feb-08 2:07 
GeneralRe: Casting ULARGE_INTEGER as FILETIME Pin
David Crow25-Feb-08 2:19
David Crow25-Feb-08 2:19 
GeneralRe: Casting ULARGE_INTEGER as FILETIME Pin
Ben Aldhouse25-Feb-08 3:10
Ben Aldhouse25-Feb-08 3:10 
QuestionRe: Casting ULARGE_INTEGER as FILETIME Pin
David Crow25-Feb-08 3:53
David Crow25-Feb-08 3:53 
GeneralRe: Casting ULARGE_INTEGER as FILETIME Pin
Ben Aldhouse25-Feb-08 5:02
Ben Aldhouse25-Feb-08 5:02 
QuestionRe: Casting ULARGE_INTEGER as FILETIME Pin
David Crow25-Feb-08 5:09
David Crow25-Feb-08 5:09 
GeneralRe: Casting ULARGE_INTEGER as FILETIME Pin
Ben Aldhouse25-Feb-08 8:37
Ben Aldhouse25-Feb-08 8:37 
GeneralTo sort shortcut menus programmatically [modified] Pin
Mushtaque Nizamani25-Feb-08 0:49
Mushtaque Nizamani25-Feb-08 0:49 
GeneralRe: To sort shortcut menus programmatically Pin
Iain Clarke, Warrior Programmer25-Feb-08 2:17
Iain Clarke, Warrior Programmer25-Feb-08 2:17 
GeneralRe: To sort shortcut menus programmatically Pin
David Crow25-Feb-08 2:43
David Crow25-Feb-08 2:43 
QuestionHow to restore dialog? Pin
sheetal_0625-Feb-08 0:47
sheetal_0625-Feb-08 0:47 
AnswerRe: How to restore dialog? Pin
David Crow25-Feb-08 2:52
David Crow25-Feb-08 2:52 
GeneralRe: How to restore dialog? Pin
sheetal_0627-Feb-08 17:44
sheetal_0627-Feb-08 17:44 
QuestionRe: How to restore dialog? Pin
David Crow28-Feb-08 2:35
David Crow28-Feb-08 2:35 
AnswerManifest for UAC, how to? (VC2005) [Solved] Pin
Maxwell Chen24-Feb-08 23:49
Maxwell Chen24-Feb-08 23:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.