Reply
Tue 6 Mar, 2012 12:21 pm
If the class is immutable, when does it change the values of its attributes? Does it only change the attributes, when it calls the constructor of the class with attributes as its parameters?
@alvoutila,
alvoutila wrote:
If the class is immutable, when does it change the values of its attributes? Does it only change the attributes, when it calls the constructor of the class with attributes as its parameters?
I think the only quality a class might change and still be immutable is percentage relative to other classes, or number... Mutation is change...
@Fido,
Fido, I don't think you understand the question. This is a question about technology-- specifically object-oriented programming. I don't know if your answer makes sense in any field... but it certainly doesn't make sense here.
@alvoutila,
Yes, in an immutable class the members are set when the instance is constructed, or the class is loaded. They are not modified at any other time.