Consider the following Java classes: Draw the virtual tables of class A, B and C
ID: 3770323 • Letter: C
Question
Consider the following Java classes: Draw the virtual tables of class A, B and C. Consider the following polymorphic function: void function: Give pseudo code for the body of func after compilation. Assume that the address of b is stored in a pointer this, and that the target machine has 4-byte addresses. You only need to show how subtyping polymorphism is implemented using dynamic dispatching. You can ignore the calling sequence (e.g., save and restore registers, store return address and so on). What are the outputs of the following code? What would be the outputs if Java used static dispatching rather than dynamic dispatching?Explanation / Answer
a) Virtual tables of class A, B and C:
c)
The output of the program will be A2 C2.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.