Can any one help me in finding the basic difference between mutable and immutable?
Can any one help me in finding the basic difference between mutable and immutable?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Immutable means that once initialized, the state of an object cannot change.
Mutable means it can.
For example – strings in .NET are immutable. Whenever you do an operation on a string (trims, upper casing, etc…) a new string gets created.
In practice, if you want to create an immutable type, you only allow getters on it and do not allow any state changes (so any private field cannot change once the constructor finished running).