Click here to Skip to main content
15,887,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
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
Posted
Comments
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
C#
myClass.add(index, count);

Should it become:
C#
myClass.add(index, count, numberOfBananas);
Or
C#
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:
C#
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
 
v2

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