Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. This question is about code generation. The first two parts make reference to the following program fragment in a Java-like language: class MyInt {
2. This question is about code generation. The first two parts make reference to the following program fragment in a Java-like language: class MyInt { private int n; public My Int (int i) { n=j; } public int f (int x) { n=n+1; return n*x; } public MyInt g (int x) { int j x+n; MyInt r = new MyInt()); return r; } } (b) Explain how the compilation of methods and method invocation in object-oriented languages, can be reduced to the compilation of procedures and procedure calls. Your answer should suppose an approach involving method tables. ii. Explain briefly how method bodies are stored in memory, and how these memory locations may be found at run-time in a method invocation. [10 marks]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started