Say I have a class A which has an Event "event1" which class B needs to listen for. I want class B to also be a property of class A, ie. I can instantiate obj = A(B). Ideally, in this process B would be set to listen for "event1" from A, but since Matlab builds B first, it does not know anything about A, and thus it has to be done effectively during the instantiation of A. The more complicated version is A(B(C)), where once again C needs to listen for "event1" in A, but is a property of B, which is a property of A.
In a nutshell I have an object A which is supplying the base data to a process which can involve anywhere from one to multiple filters, which is acted on and ultimately passed back to A… so the initial data needs to go to the bottom filter… the filters are defined by classes, in order to be portable and used in different situations..
The question, is there an efficient way to either define the classes or to instantiate the classes that would allow me to have the inner most nested class listen to the Event "event1" in the outer class without having to build a bunch of conditionals in the outer class instantiation function.
Best Answer