#include <iostream.h>
/***********************************************************
 An example to demonstrate ambiguity in Function Overloading
***********************************************************/

int main(){
	void Print();
	void Print(int x=0);
	
	cout << "Calling Print..." << Print() << endl;
	cout << "Calling Print..." << Print() << endl;

	return(0);
}

void Print(){
	cout << "Print()\n";	
}

void Print(int x){
	cout << "Print(int )\n";	
}

Output: jinx> g++ oload.C oload.C: In function `int main()': oload.C:10: call of overloaded `Print' is ambiguous oload.C:8: candidates are: Print(int) oload.C:7: Print() oload.C:11: call of overloaded `Print' is ambiguous oload.C:8: candidates are: Print(int) oload.C:7: Print()



Back to Previous Page

Document:
Local Date:
Last Modified On: