Question: Use the following C++ program to answer questions Q5 to Q10? Q5: Write down the FIRST LINE OF OUTPUT. class Bee { protected: int x;

Use the following C++ program to answer questions Q5 to Q10?

Q5: Write down the FIRST LINE OF OUTPUT.

class Bee {

protected:

int x;

public:

Bee(int k) { x=k; }

virtual ~Bee(){ cout << "<1>:" << x << endl; }

virtual void f1() { cout << "<2>"; }

voidf2(){ cout << "<3>"; }

};

class HoneyBee: public Bee {

char c;

public:

HoneyBee(int m, char z):Bee(m) { c = z; }

virtual ~HoneyBee() { cout << "[4]:" << x << "," << c << endl; }

voidf1(){ cout << "[5]"; }

voidf2(){ cout << "[6]"; }

};

int main(){

Bee* wow[2];

wow[0] = new Bee(10);

wow[1] = new HoneyBee(-22, '$');

wow[0]->f1();

wow[1]->f1();

wow[0]->f2();

wow[1]->f2();

delete wow[0];

delete wow[1];

return 0;

could you explain the first,second and third line of output?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!