This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am in a situation where I have two classes AA and BB,
where "BB bb;" is a member of AA aa.
I wish to send info from the interior of class BB up to class AA.
Note the direction - from AA to BB is easy, since bb is a member of aa, but talking back to aa??
Using events? All literature I find about events deals with Keyboard events, Timer events, Mouse events, all induced by external actions. Nothing about my own custom-made 'burp' events, induced by the code in the BB object.
Is there a method other than using events for a member object to communication with its parent object?
your terminology is confusing. 'parent' usually refers to an inheritance relationship:
Member object usually refers to a class being a member variable of another class:
In the second case, it would be very dangerous to expect to be able to do this. How do you know if the member variable is actually in a container class? What if it is in two or more? What if it is one minute, but not the next?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Dec 27, 2002
Yes, my terminology is really for the birds, but whence the worry about membership in a container class??
It doesn't really seem realistic to me.
(And I solved the custom event problem in the meantime)
Anyway this is the scenario.
1. BB bb is a member of AA aa
2. and AA aa is a member of main()
3. In the future AA will be a form with text boxes and a panel and
the class BB will be the code behind the panel (so BB is a member of AA).
I want a change in the panel code to fill in a text box in the AA form when circumstances demand it
This is main()
This is AA
This is BB
These are BurpEvent, BurpListener and MyBurpListener from three files