Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) Give an example of the declaration of the default constructor for the class PolarBear. Briefly explain what would happen if the default constructor was

image text in transcribed
(b) Give an example of the declaration of the default constructor for the class PolarBear. Briefly explain what would happen if the default constructor was not declared or defined for this class. [4 marks] (c) Objects model state and behaviour. Explain how state and behaviour are implemented in C++. [2 marks] (d) The PolarBear class is defined as follows name: string // This is the PolarBear's personal name location: string II This is the name of the country that they are in size: integer /1 This is the PolarBear's weight in kilograms i. Assuming that the appropriate constructor exists, give the C++ code that will produce an object for a PolarBear called Harry who is in Norway and weighs 200 kilograms [4 marks] ii. You are asked to provide a new function to be placed in class PolarBear with the signature boolean move (string newLocation) that will change a PolarBear's location but only if the location is not the empty string. The function will return true if the move has taken place, false otherwise. Write the C++ code for this function. You may assume it has already been correctly declared. [6 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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago