6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology objects, whether we want to delegate behaviors to specific superclasses, or to simply inherit behaviors by following up the chain of classes Slide 14.2.9 An initial class hierarchy Now lets add one final type of object to our system, a student. (define stud (make student "bert sesame)) tudents are al ways very polite, so they have their own say method, which prepends the words"Excuse me, but to the front ask stud SA not understand)) of everything they say. WHOAREYOU?)Exeuse me, bu An initial class hierarchy Slide 14.2.10 Now suppose we go back to our class diagram, and decide to PERSON tnam。 modify our classes. For example, we want students to have the ability to ask a question of a professor. And of course, we need to add the ability for a professor to answer which we choose do within the arrogant-prof class. But we also decide that occasionally even a professor might have the need to ask a question In terms of our object system, this simply would require redefining whatever mechanism we use to create instances. so that a new method is included in that class definition Slide 14211 An initial class hierarch Note that in this case, we want our objects to take several (ask std'question why does this rode work) arguments, in particular, both the question and the object to PERSON→ hoeld be obvious t which the question is being directed. Also note the use of ap-1 as an argument, meaning we want the actual instance, not just the name of that instance We still have to define how we want the arrogant-prof to PROFESSOR STUDENT respond. We choose to incorporate the following behavior. If the OUESTION question is being asked by a student, then the arrogant-prof will respond by saying this should be obvious to you ARROGANT-P ANSWER6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. objects, whether we want to delegate behaviors to specific superclasses, or to simply inherit behaviors by following up the chain of classes. Slide 14.2.9 Now let’s add one final type of object to our system, a student. Students are always very polite, so they have their own say method, which prepends the words “Excuse me, but” to the front of everything they say. Slide 14.2.10 Now suppose we go back to our class diagram, and decide to modify our classes. For example, we want students to have the ability to ask a question of a professor. And of course, we need to add the ability for a professor to answer, which we choose to do within the arrogant-prof class. But we also decide that occasionally even a professor might have the need to ask a question. In terms of our object system, this simply would require redefining whatever mechanism we use to create classes and instances, so that a new method is included in that class definition. Slide 14.2.11 Note that in this case, we want our objects to take several arguments, in particular, both the question and the object to which the question is being directed. Also note the use of ap-1 as an argument, meaning we want the actual instance, not just the name of that instance. We still have to define how we want the arrogant-prof to respond. We choose to incorporate the following behavior. If the question is being asked by a student, then the arrogant-prof will respond by saying “this should be obvious to you