Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 { 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
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