Mar-14-2022, 11:21 PM
(This post was last modified: Mar-14-2022, 11:21 PM by deanhystad.)
It is not a good idea to have a class reference attributes of an unrelated (not a superclass) class. It is almost acceptable if class B is responsible for creating creating instances of class A. "I brought you into this world and I can can check your credit card balance." It is still bad parenting, but sometimes required. If there are A objects outside the scope of B, and B does things other than cater to A, it is a better design to have a helper function that knows about A and B and implements the passage of information between them.
As to the PyQt example, I would either bind the control's signal to a method in A, or have the control call a helper function that knows about A.
As to the PyQt example, I would either bind the control's signal to a method in A, or have the control call a helper function that knows about A.