Hi Guys,

Here is the drawback of using default arguments:

 

Code:

int main()

{

            void f(std::string s, std::string s1, bool flag = true);

            void f(std::string s, bool flag);

            void g();

 

g();

getch();

return 0

}

 

void f(std::string s, std::string s1, bool flag = true)

{

std::cout<<"Three parameter Function";

}

 

 

void f(std::string s, bool flag)

{

std::cout<<"Two parameter Function";

}

 

void g()

{

f("test","application");

}

 

Output:

Two Parameter Function..

 

 

For further clarification of the topic feel free to revert back....

Comments and suggestions are higly Welcome!

 

Regards,
Rajiv Podar



 



[Non-text portions of this message have been removed]

Reply via email to