in reply to Re^2: Perl OOP
in thread Perl OOP
I perhaps don't understand your question, but if you want an object which can be created but not modified after its creation... just don't expose any "set" functions for parameters within that object - set all of the params in the "new" method. Nothing in Perl that I know of will prevent you from inheriting from such an object.
I would think that normally your object should have a "has a" relationship to an immutable object rather than your object being an "is a" relationship to said object. Perl will allow you to do something stupid.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl OOP
by tobyink (Canon) on Jul 05, 2017 at 09:24 UTC | |
by tobyink (Canon) on Jul 05, 2017 at 10:27 UTC |