Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a function add(int a, int b)
now i added add( int a , int b, int c)

I called this function in more then 50 pleaces.

How to change in all the places at a same time.

Thank you
Richard MacCutchan 20-May-15 6:21am    
Use the editor.
Black_Rose 20-May-15 6:22am    
editor..?? i m in VS2012
Richard MacCutchan 20-May-15 6:32am    
Yes, and how do you edit the code in VS2012?
Andy Lanng 20-May-15 6:21am    
do you need to? you can overload the function so both versions are valid.
Black_Rose 20-May-15 6:22am    
I need to.

1 solution

You can't really do that - because nobody knows what value or variable should be added in!
If the existing code is
myClass.add(index, count);

Should it become:
myClass.add(index, count, numberOfBananas);
myClass.add(index, count, 0);
It all depends on the context of why your code is calling the method.
But...the easiest way may be to change the definition of your "new" method:
public int add(int a, int b, int c = 0)
   return a + b + c;
In which case your external code will need no changes at all as the final value will be defaulted to zero unless it is specified.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900