Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
