Need help with these class errors on a basic math program

Getting tons of errors all of a sudden after adding a few things to this. I've been looking up lectures and guides and I can't get it to work. I've tried tracing my steps back and trying to start from scratch but cant seem to get it to work.
********************************************************************************

//integer.h
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
#ifndef INTEGER
#define INTEGER
#include "Double.h"

class Integer
{
private:
	int data;
public:


	Integer();
	Integer(int i);
	Integer(const Integer &i);
	Integer(const Double &d);
	void equals(int i);
	Integer add(const Integer &i);
	Integer sub(const Integer &i);
	Integer mul(const Integer &i);
	Integer div(const Integer &i);
	Integer add(int i);
	Integer sub(int i);
	Integer mul(int i);
	Integer div(int i);
	int toInt() const;
	Integer operator + (const Integer &i);
	Integer operator - (const Integer &i);
	Integer operator * (const Integer &i);
	Integer operator / (const Integer &i);
	Integer operator = (const Integer &i);
	Integer operator = (int i);
	bool operator == (const Integer &i);
	bool operator == (int i);
	bool operator != (const Integer &i);
	bool operator != (int i);
};


#endif
********************************************************************************
//integer.cpp
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <iostream>
#include <string>
#include <sstream>
#include "Double.h"
#include "Integer.h"

using namespace std;

Integer::Integer()
{
	this->equals(0);
}

Integer::Integer(int i)
{
	this->equals(i);
}

Integer::Integer(const Integer &i)
{
	this->equals(i.data);
}
Integer::Integer(const Double &d)
{
	this->equals((int)d.toDouble());
}
void Integer::equals(int i)
{
	this->data = i;
}
Integer Integer::add(const Integer &i)
{
	Integer tmp;
	tmp.data = data + i.data;
	return tmp;
}
Integer Integer::sub(const Integer &i)
{
	Integer tmp;
	tmp.data = data - i.data;
	return tmp;
}
Integer Integer::mul(const Integer &i)
{
	Integer tmp;
	tmp.data = data * i.data;
	return tmp;
}
Integer Integer::div(const Integer &i)
{
	Integer tmp;
	tmp.data = data / i.data;
	return tmp;
}
//Primitives
Integer Integer::add(int i)
{
	Integer tmp;
	tmp.equals(this->toInt() + i);
	return tmp;
}
Integer Integer::sub(int i)
{
	Integer tmp;
	tmp.equals(this->toInt() - i);
	return tmp;
}
Integer Integer::mul(int i)
{
	Integer tmp;
	tmp.equals(this->toInt() * i);
	return tmp;
}
Integer Integer::div(int i)
{
	Integer tmp;
	tmp.equals(this->toInt() / i);
	return tmp;
}
int Integer::toInt() const
{
	return data;
}
Integer Integer::operator + (const Integer &i)
{
	return this->add(i);
}
Integer Integer::operator - (const Integer &i)
{
	return this->sub(i);
}
Integer Integer::operator * (const Integer &i)
{
	return this->mul(i);
}
Integer Integer::operator / (const Integer &i)
{
	return this->div(i);
}
Integer Integer::operator = (const Integer &i)
{
	this->equals(i.toInt());
	return *this;
}
Integer Integer::operator = (int i)
{
	this->equals(i);
	return *this;
}
bool Integer::operator == (const Integer &i)
{
	return this->data == i.data;
}
bool Integer::operator == (int i)
{
	return this->data == i;
}
bool Integer::operator != (const Integer &i)
{
	return this->data != i.data;
}
bool Integer::operator != (int i)
{
	return this->data != i;
}

******************************************************************************
Whenever I try to compile it I get a ton of errors.
1>------ Rebuild All started: Project: rand midT, Configuration: Debug Win32 ------
1> Random.cpp
1> main.cpp
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2143: syntax error: missing ',' before '&'
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2535: 'Integer::Integer(int)': member function already defined or declared
1> c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(13): note: see declaration of 'Integer::Integer'
1> Integer.cpp
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2143: syntax error: missing ',' before '&'
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2535: 'Integer::Integer(int)': member function already defined or declared
1> c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(13): note: see declaration of 'Integer::Integer'
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.cpp(24): error C2511: 'Integer::Integer(const Double &)': overloaded member function not found in 'Integer'
1> c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(6): note: see declaration of 'Integer'
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.cpp(25): error C2671: 'Integer::{ctor}': static member functions do not have 'this' pointers
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.cpp(25): error C2227: left of '->equals' must point to class/struct/union/generic type
1> Double.cpp
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2143: syntax error: missing ',' before '&'
1>c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(15): error C2535: 'Integer::Integer(int)': member function already defined or declared
1> c:\users\danie\onedrive\documents\visual studio 2015\projects\rand midt\rand midt\integer.h(13): note: see declaration of 'Integer::Integer'
1> Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Last edited on
Can you show us your Double class?
I hope I'm allowed to post it here.
********************************************************************************

//double.h
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
#ifndef DOUBLE
#define DOUBLE
#include "Integer.h"

class Double
{
private:
	double data;
public:

	// Constructors
	Double();
	Double(double d);
	Double(const Double &d);
	Double(const Integer &i);

	void equals(double d);
	Double add(const Double &d);
	Double sub(const Double &d);
	Double mul(const Double &d);
	Double div(const Double &d);
	Double add(double d);
	Double sub(double d);
	Double mul(double d);
	Double div(double d);
	double toDouble() const;

	// operator overloads
	Double operator + (const Double &d);
	Double operator - (const Double &d);
	Double operator * (const Double &d);
	Double operator / (const Double &d);
	Double operator = (const Double &d);
	Double operator = (double d);
	bool operator == (const Double &d);
	bool operator == (double d);
	bool operator != (const Double &d);
	bool operator != (double d);
};

#endif 

***************************************************************************
//double.cpp
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <iostream>
#include <string>
#include <sstream>
#include "Double.h"
#include "Integer.h"

using namespace std;

Double::Double()
{
	this->equals(0);
}

Double::Double(double d)
{
	this->equals(d);
}

Double::Double(const Double &d)
{
	this->equals(d.data);
}
Double::Double(const Integer &i)
{
	this->equals((double)i.toInt());
}
void Double::equals(double d)
{
	this->data = d;
}
Double Double::add(const Double &d)
{
	Double tmp;
	tmp.data = data + d.data;
	return tmp;
}
Double Double::sub(const Double &d)
{
	Double tmp;
	tmp.data = data - d.data;
	return tmp;
}
Double Double::mul(const Double &d)
{
	Double tmp;
	tmp.data = data * d.data;
	return tmp;
}
Double Double::div(const Double &d)
{
	Double tmp;
	tmp.data = data / d.data;
	return tmp;
}
//Primitives
Double Double::add(double d)
{
	Double tmp;
	tmp.equals(this->toDouble() + d);
	return tmp;
}
Double Double::sub(double d)
{
	Double tmp;
	tmp.equals(this->toDouble() - d);
	return tmp;
}
Double Double::mul(double d)
{
	Double tmp;
	tmp.equals(this->toDouble() * d);
	return tmp;
}
Double Double::div(double d)
{
	Double tmp;
	tmp.equals(this->toDouble() / d);
	return tmp;
}
double Double::toDouble() const
{
	return data;
}
Double Double::operator + (const Double &d)
{
	return this->add(d);
}
Double Double::operator - (const Double &d)
{
	return this->sub(d);
}
Double Double::operator * (const Double &d)
{
	return this->mul(d);
}
Double Double::operator / (const Double &d)
{
	return this->div(d);
}
Double Double::operator = (const Double &d)
{
	this->equals(d.toDouble());
	return *this;
}
Double Double::operator = (double d)
{
	this->equals(d);
	return *this;
}
bool Double::operator == (const Double &d)
{
	return this->data == d.data;
}
bool Double::operator == (double d)
{
	return this->data == d;
}
bool Double::operator != (const Double &d)
{
	return this->data != d.data;
}
bool Double::operator != (double d)
{
	return this->data != d;
}

********************************************************************************
adding class Integer; into the header seems to have resolved the errors but I don't know if it will effect the overall program.
Topic archived. No new replies allowed.