Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language / Type:C + + inheritance polymorphism Consider the following classes; assume that each is defined in its own file. class Hamburger : public Bacon
LanguageType:C inheritance polymorphism
Consider the following classes; assume that each is defined in its own file.
class Hamburger : public Bacon
public:
virtual void m
cout H endl;
Bacon::m;
virtual void m
cout H endl;
;
class Mayo : public Hamburger
public:
virtual void m
cout M endl;
m;
virtual void m
cout M endl;
;
class Lettuce
public:
virtual void m
cout L endl;
m;
virtual void m
cout L endl;
;
class Bacon : public Lettuce
public:
virtual void m
Lettuce::m;
cout B endl;
virtual void m
cout B endl;
;
Now assume that the following variables are defined:
Lettuce var new Bacon;
Bacon var new Mayo;
Lettuce var new Hamburger;
Bacon var new Hamburger;
Lettuce var new Lettuce;
In the table below, indicate in the righthand column the output produced by the statement in the lefthand column. If the statement produces more than one line of output, indicate the line breaks with slashes as in x y z to indicate three lines of output with x followed by y followed by z If the statement does not compile, write "COMPILER ERROR". If a statement would crash at runtime or cause unpredictable behavior, write "CRASH".You passed of tests. Try again.
table#question,your answer,resultvarmLLBpassvarm;LpassvarmCOMPILER ERROR,passvarmM LLox failvarmHLpassvarmM LLox failvarmCOMPILER ERROR,passvarmM LLx failvarmHLpassvarmH L passvarmB passvarmCOMPILER ERROR,pass Bacon var m;LLBpass Bacon varm;B pass Mayo varm;CRASH,passLettuce varm;COMPILER ERROR,pass Hamburgervarm;M pass MayovarmM pass
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