Answered step by step
Verified Expert Solution
Link Copied!

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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

student submitted image, transcription available belowstudent submitted image, transcription available below

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Research Methods For Business Students

Authors: Mark Saunders, Philip Lewis, Adrian Thornhill

5th Edition

273716867, 978-0273716860

More Books

Students also viewed these Programming questions

Question

i need 3 0 7 .

Answered: 1 week ago

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago