Constructor/destructor class

Im having trouble writing the code for a class box. I keep getting an error that says overloaded member function not found in 'BOX'. Im not sure what exactly it means. I would appreciate any help, thanks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
class BOX		//class definition
{
public:
	
	BOX (double, double, double, double, double, double);		//contructor function
		~BOX();														//destructr function
		void set_size( double, double, double, double, double);		// changes l,w,h,th, wt,color
		double calc_area();											//for area
		double calc_volume();										//for volume
														//color of box
		void print_report();

private:
	double length;
	double width;
	double height;
	double thickness;
	double weight;
};

BOX::BOX (double l, double w, double h, double th, double wt){		//constuctor
	length=l;
	width=w;
	height=h;
	thickness=th;
	weight=wt;
	
}

BOX::~BOX()														//destuctor
{
	cout << " Destroying contents of BOX object" << endl;
}

void BOX::set_size (double l, double w, double h, double th, double wt)
{
	length=l;
	width=w;
	height=h;
	thickness=th;
	weight=wt;
	cout << "Size has been reset to" << length << "x" << width << "x" << height 
		<< "Thickness = " << thickness << " Weight = " << weight << endl;
}

double BOX::calc_area()
{
	return (2*(length*width)+2*(height*length)+2*(height*width))
}

double BOX::calc_volume()
{
	return (length*width*height)
}

void BOX::print_report()
{
	cout << "L x W x H = " << length << " x " << width << " x " << height << " , A = " << calc_volume() << " Area = " <<
		calc_area() << "Thickness = " << thickness << "Weight = " << weight  <<  endl;
}

int main()
{
	cout.setf(ios::fixed, ios:: floatfield);  // set up floating point capability
	cout.setf(ios::showpoint);                // set up floating point capability
	cout << setprecision(2); 

	BOX Rob (7.5, 2.75, 1.8, 0.1, 33.5 );
		cout << "For Box named Rob: " << endl;
		Rob.print_report();
		Rob.set_size(7.5,2.75, 0.75,0.1,33.5);
		Rob.print_report();

		cout << "Thanks and goodbye" << endl;
		return 0;

}
Last edited on
closed account (D80DSL3A)
Too many doubles in the prototype:
BOX (double, double, double, double, double, double);// 6 args
Definition must match:
 
BOX::BOX (double l, double w, double h, double th, double wt)// 5 args 
Thanks fun2code, guess i got a little carried away. Thanks a bunch.
Topic archived. No new replies allowed.