john

john

  • NA
  • 12
  • 0

Overloads

Nov 4 2003 1:51 PM
Quick and simple one. I know how to do overloads, that isn't really the question. The question is better explained by a couple samples. I know both of these methods work. What I want to know is what is the "RECOMMENDED" way of providing these defaults. Just trying to make the code right the first time so others can read it. A little work up front can save alot of work later. Sample #1 class { function void functiona(string x) : { functiona(x, "defaultstring"); } function void functiona(string x, string y) { /// some logic here } } Sample #2 class { private static string defaultString = "defaultstring"; function void functiona(string x) : { functiona(x, defaultString); } function void functiona(string x, string y) { /// some logic here } }

Answers (1)