How is inheritance of class variables typically implemented by a compiler

Explain how a function value may be represented at run-time
March 21, 2023
What are the principal features of a regular language and of a context-free
March 21, 2023

How is inheritance of class variables typically implemented by a compiler

2010 Paper 3 Question 4
Compiler Construction
(a) How is inheritance of class variables typically implemented by a compiler for
an object-oriented language in which each class has exactly one parent?
[3 marks]
(b) When supporting multiple inheritance, what extra run-time complexity arises
when casting or coercing an object handle up or down and why is this avoided
using the Java concept of an interface? [3 marks]
(c) When supporting multiple inheritance, what identifier clash problem can arise
and what are the possible solutions? [4 marks]
(d) Explain, using an example, the potential for an erroneous downcast in an
object-oriented language such as Java, C++ or C#. [4 marks]
(e) Sketch assembly-level code that
(i) detects an erroneous downcast;
(ii) finds an exception handler for it; and
(iii) correctly jumps to the handler.
Assume that the handler is already registered with the run-time system
and that there are no arguments to the exception. Use any well-known
implementation techniques, such as keeping an object’s identity in its virtual
method table and stacking exception handlers on an extra run-time stack.
[6 marks]