Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[ Prob . 6 . Fundamental of Programming ] ( 1 5 p ) Answer for the following C + + program. #include iostream using
Prob Fundamental of Programming
p Answer for the following C program.
#include iostream
using namespace std;
class A
public:
virtual void foo cout Afoo endl; same as printfAfoo
; in C
virtual void boo cout Aboo endl;
;
class B: public A
public:
virtual void boo cout Bboo endl;
virtual void zoo cout Bzoo endl;
;
int main
B b;
bfoo; bzoo;
&;
afoo; aboo; HERE
a Show the output of the above program there are four lines
b For the output, which output lines correspond to a case where polymorphism,
overriding, and virtual function call occur all together? Explain briefly.
c If we add a statement azoo; at HERE in the above, can it be compiled
correctly? If so can it run correctly? If so what is its output? Explain briefly.
p Answer the following questions in two lines penalty if more than two lines
a Pointers are tricky to use. Why do we need pointers in programming? That is
what are pointers mainly used for in programming?
b We can implement a Set using an array or a linked list. What is the advantage
of linked list compared to array? What is the disadvantage?
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