If foo is an abstract class in a C++ program, why is it acceptable to declare variables of type foo*, but not of type foo? Consider the Java program shown in Figure 10.8. Assume that this is to be...

If foo is an abstract class in a C++ program, why is it acceptable to declare variables of type foo*, but not of type foo? Consider the Java program shown in Figure 10.8. Assume that this is to be compiled to native code on a machine with 4-byte addresses. (a) Draw a picture of the layout in memory of the object created at line 15. Show all virtual function tables. (b) Give assembly-level pseudocode for the call to c.val at line 19. You may assume that the address of c is in register r1 immediately before the call, and that this same register should be used to pass the hidden this parameter. You may ignore the need to save and restore registers, and don’t worry about where to put the return value.










(c) Give assembly-level pseudocode for the call to c.ping at line 17. Again, assume that the address of c is in register r1, that this is the same register that should be used to pass this, and that you don’t need to save or restore any registers. (d) Give assembly-level pseudocode for the body of method Counter.ping (again ignoring register save/restore).



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here