What is an immutable object and how would I use it?

An immutable object is an object whose state can't be changed in any way through it's public interface. So it has no public variables and none of its public methods change any of its variables. One example of such objects are strings.

You'd use those object like you'd use any other objects.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.