Question: Theoretical Questions . . . . . . . . . . . . . . . . . . . . . . .

Theoretical Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1 [2 points] Why is it important that we make use of virtual destructors?
1.2 [2 points] What is an abstract class?

Question 2 Practical Questions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Question 2 Practical Questions..... Consider the following classes: class Animal { privatebool carnivore; public: Animal (bool b = false) carnivore (b) { cout

Question 2 Practical Questions..... Consider the following classes: class Animal { private bool carnivore; public: Animal (bool b = false) carnivore (b) { cout < < "A+" < < endl; } Animal(){ cout < < "A-" < < < endl; } virtual void eat (); }; class Carnivore public Animal { public: Carnivore (){ cout < < "C+" < < < endl; } Carnivore() { cout < < "C-" < < endl; } virtual void hunt (); }; class Lion public Carnivore { } public: Lion() { cout < < "L+" < < endl; } Lion(){ cout < < "L-" < < endl; } void hunt (); }; int main() { Lion 1; Animal a: .(11 marks)

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!