Design the stack with all activation record instances, including static and dynamic chains,
when execution reaches position (A) in the following skeletal program. Assume outer is
at level 1.
B. Consider the following C++ skeletal program:
4 marks
#include
class Large {
int X;
float y;
void Larg_Fun() noexcept(false) {
try {
std::cout << "Larg_ Fun() some code\n":
(x <0) {
throw X;
)
std.ncout << "Larg_Fun(): some code\n";
if (y>0) {
throw y;
-
}
std::cout << "Larg_Fun(): some code\n";
}
catch (int) {
std::cout << "Larg_Fun(): catch(int)\n";
throw;
}
}
};
class Small {
inta;
float b;
void Small_Fun() noexcept(false) {
try {
std:cout << "Small_Fun(): some code\n";
Large I;
I.Larg_Fun();
std::cout << "Small_Fun(): some code\n";
if (a ) 0) {
-
throw a;
}
std.:cout << "Small_Fun(): some code\n";
if (b<0) (
throw b;
-
}
std.cout << "Small_Fun(): some code\n";
}
Based on the information provided, the student is asking for an explanation of a C++ skeletal program related to a stack with activation record instances. However, the student's question does not explicitly ask for code to be written or for a function to be defined and tested. Instead, the student is seeking assistance in understanding and analyzing the provided C++ code.
Since the student's question does not require writing new code, I will provide an explanation of the C++ skeletal program and how to approach the design of the stack with activation record instances.
Please note that the actual code and the point (A) in the program are not provided in the question, so a more detailed analysis of the stack at that specific point cannot be given without additional information.
Not the question you are looking for? Ask here!
Enter question by text
Enter question by image
Unlock Smarter Learning with AskSia Super!
Join Super, our all-in-one AI solution that can greatly improve your learning efficiency.