in reply to Re^3: Thoughts on new 'class' OO in upcoming perl
in thread Thoughts on new 'class' OO in upcoming perl
Child classes have no access to parent attributes unless there are (public) accessor methods for them.
That does not make any sense to the way i do OO. Often enough, i write a base class which does the basics, like for instance, handling a websocket. Then i subclass this and override the empty methods in the base class i need to handle this specific websocket connection. I would still need access to all the stuff in the base class. Yes, technically, i could write accessors, but the would just bloat the code and make it slower. It wouldn't provide any benefits that i can see.
In fact, it might be contraproductive to provide public methods to access the internals in some cases. I might want to give the child classes the ability to fiddle with internal settings of the websocket, but not provide the object creator (? i mean the object that called new()) the same kind of access.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Thoughts on new 'class' OO in upcoming perl
by haj (Vicar) on Mar 20, 2023 at 22:01 UTC | |
Re^5: Thoughts on new 'class' OO in upcoming perl
by Jenda (Abbot) on Apr 10, 2023 at 11:20 UTC |