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