Reference no: EM13165968
Take the code below and add a copy constructor, assignment operator definition and destructor to the class. These functions have already been started for you.
#include <iostream>
#include <string>
using namespace std;
class Tool
{
public:
string getType()
{
return type;
}
int getQuant()
{
return quantity;
}
void set(string s, int q)
{
type = s;
quantity = q;
}
private:
string type;
int quantity;
};
class ToolBox2
{
public:
ToolBox2()
{
count = 3;
t = new Tool[count];
}
ToolBox2(int c)
{
if (c > 1)
count = c;
else
count = 3;
t = new Tool[count];
}
// copy constructor
ToolBox2(ToolBox2 &otherbox)
{
}
// assignment operator
ToolBox2& operator=(ToolBox2 &otherbox)
{
}
// destructor
~ToolBox2()
{
}
void set(int index, string s, int q)
{
t[index].set(s, q);
}
void display()
{
cout << "the tools are\n";
for (int i=0; i<count; i++)
cout << t[i].getType() << ": " << t[i].getQuant() << endl;
}
private:
Tool *t;
int count;
};
int main()
{
ToolBox2 tb2;
tb2.set(0, "screwdrivers", 8);
tb2.set(1, "pliers", 5);
tb2.set(2, "wrenches", 20);
tb2.display();
return 0;
}
Find out the amount of iron chloride hexahrdrate
: The solution of iron (III) chloride used in this experiment is 0.02M. Determine the amount of iron (III) chloride hexahrdrate
|
How much energy in calories was absorbed
: A canister is filled with 310 of ice and 100. of liquid water, both at 0 . The canister is placed in an oven until all the has boiled off and the canister is empty. How much energy in calories was absorbed?
|
Reaction to the public service announcement-e-activity
: From the e-Activity, discuss your reaction to the public service announcement in relation to the marketing of junk food to children, with a focus on why or why not this PSA is appropriate.
|
What mass of calcium oxide is required daily
: If the coal is burned in a power plant that uses 1800 tons of coal per day, what mass of calcium oxide is required daily to eliminate the sulfur dioxide?
|
Add a copy constructor
: Take the code below and add a copy constructor, assignment operator definition and destructor to the class. These functions have already been started for you.
|
State polyethylene is a polymer consisting of only carbon
: Polyethylene is a polymer consisting of only carbon and hydrogen. If 2.300 g of the polymer is burned in oxygen it produces
|
How much heat is required to vaporize
: the heat of vaporization of benzene, C6H6, is 30.8kJ/mol at its boiling point of 80.1C. How much heat is required to vaporize 102g benzene at its boiling point?
|
Beginning with the row number passed
: Write a MATLAB function that takes a matrix, a row number and a column number. Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in ..
|
State calibrate ion-selective electrodes
: You will need two series of standard solutions to calibrate your ion-selective electrodes - one series for sodium and one for calcium.
|