Is it possible to set a object's value, and once that value is set not allow it to change?

I could write a method to do it, but I wasn't sure if there was some sort of modifier I could use?

I need to set a value once, and not allow it to change at all, but the value needs to be dynamic at run-time.

For example, assigning a value to an integer, and as long as that class is alive that has that field, it will always keep that value and if someone, or something, attempts to change the value it throws a fit and/or refuses to change it.

Anyone know if that's possible?

Recommended Answers

All 4 Replies

Will we bet that I have already felt more like an idiot in my life than you?:D
So don't worry, it is just part of life I guess.

So true...about the part of life comment I mean :P

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.