Advertisements
Advertisements
Question
Differentiate between pure and impure methods.
Distinguish Between
Solution
S. No. | Pure method | Impure method |
1. | A method that returns a value to its caller module is known as a "pure method." | An impure method may not return any value. It simply modifies the state of an object during a call. |
2. | This method, often known as the "accessor method," does not modify an object's properties. | An Impure method, often known as a Mutator, modifies the state of an object. |
shaalaa.com
Is there an error in this question or solution?
Chapter 5: User - Defined Methods - EXERCISES [Page 337]