Why do you prefer that a function (member of an object) not return a boolean value to the calling function in order to indicate that it (the called member/function) successfully completed its operation.

 Posted by deccansoft on 7/29/2010 | Category: C# Interview questions | Views: 1904

Like mentioned in the question, it isjust a preference and not a rule. It is a commonly accepted way ofdoing OOPS methodology. There is nothing wrong with returning a boolean value but it is not PREFERRED. Hence refrain from it. It is preferred that the called function/member throw/raise an exception to indicate that something went wrong in it. Again, this is just a preference and there is nothing wrong in doing it. If you do choose to use it extensively, you are moving away from doing Object Orientation or Object Oriented Programming.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response