Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 7 - Software Engineering - Chapter Review Problems - Page 368: 36

Answer

See the explanation

Work Step by Step

To achieve the desired behavior, you can use a while loop to repeatedly call the method `bb` as long as the variable "continue" remains true after B returns control. Here's an example in Python: ```python class A: def __init__(self): self.continue_flag = True def bb(self): # Your bb method implementation here class B: def __init__(self, a_instance): self.a_instance = a_instance def some_method(self): while self.a_instance.continue_flag: self.a_instance.bb() # Example usage: a_instance = A() b_instance = B(a_instance) b_instance.some_method() ``` This code snippet ensures that method `bb` in class A is called repeatedly as long as the "continue_flag" remains true after returning control to class B. Adjust the method `bb` and any other relevant parts of your code accordingly. See figure.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.