Question: Topics: Friend functions Copy constructor Overloaded operators The anti AI constraints: Any C + + terms, constructs and / or methodologies covered in CIS 2
Topics:
Friend functions
Copy constructor
Overloaded operators
The anti AI constraints:
Any C terms, constructs andor methodologies covered in CIS A are available for your use.
You may only use additional C constructs or terms covered in lecture or zyBook ebook reading
assignments found in In modules and Deviation from these constraints lose points.
Utilizing your Lab code as a starting point, move both the input and output functions declarations
outside the class. They will no longer be able to directly access your private data youll need to use
both mutators and accessors for private data access
We have added a new load type, Combo Flat. Your code will need to handle this as a string. Combo Flat
abbreviations for the are CFE, CFK and CFM
Create your objects on the stack not on the heap
Add a friend function, kilotopound, which will convert kilograms to pounds. Change your weight
mutator to ask whether weight is input in kilograms or pounds. If it is kilograms, call the friend function
kilotopound to convert it to pounds and return pounds. There are pounds in one kilogram.
Add a copy constructor.
Create an object on the stack with the following information or appropriate data of your choice:
uld Container
abbreviation AYK
uldid AYKIB
aircraft
weight Kilograms
destination PDX
Copy the object using a copy constructor. Output the contents of both objects. Your code must
include both the friend function and the copy constructor.
Now, add an overloaded operator which will be used to compare two objects to see if they are
equal. C does not allow a direct comparison of two objects, so we use an overloaded operator and
associated code to perform the comparison. For our purposes, two objects are equal if their
abbreviation and uldid are the same.
Create an object call it unit and load it with this data:
uld Pallet
abbreviation PAG
uldid PAGIB
aircraft
weight Pounds
destination SEA
Make a copy of unit called unit utilizing the copy constructor.
Create a default object called unit
Test your overloaded operator with code like this in main:
if unit unit
cout
unit is the same as unit
;
else
cout
unit is not the same as unit
;
if unit unit
cout
unit is the same as unit
;
else
cout
unit is not the same as unit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
