I have a question regarding the Object hierarchical call.
I have four classes namely A, B, C, D.
D will be set in C; C will be in B; B will be in A.
If I want to do something in class D, I have to call a.b.c.d.setWidth("50%");(a, b, c, d are instance of Class A, B, C, d).
Is that fine to call like that? Will that compromise the performance?
The effect on performance will be very slight... the bigger issue is what that does to your object-oriented model.
Having direct access to the members of a class is frowned apon, and you are running risks of NullPointerExceptions.
What you should be more worried about is the readability and maintainability of your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With