need help trying to pass a class object by reference by reference

hello all,

I'm trying to pass a class object by reference.

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
	total = mathfunction(i);

}


double mathfunction(retirement& j)
{
	double R = 0.00, m = 0.00, r = 0.00, t = 0.00, totaled = 0.00,
		numerator = 0.00, denom = 0.00, temp = 0.00;


	cout << "Doing the math" << endl;

	R = j.getdollars;
	m = j.getdeposits;
	r = j.getinterest;
	t = j.getyears;

	temp = (1 + r / m);
	temp = pow(temp, m*t);

	numerator = temp - 1;

	temp = 0;

	return totaled;
}


But i'm getting the errors:
error C3867: 'retirement::getdollars': function call missing argument list; use '&retirement::getdollars' to create a pointer to member
error C2440: '=' : cannot convert from 'double (__thiscall retirement::* )(void)' to 'double'
1> There is no context in which this conversion is possible
error C3867: 'retirement::getdeposits': function call missing argument list; use '&retirement::getdeposits' to create a pointer to member
error C2440: '=' : cannot convert from 'double (__thiscall retirement::* )(void)' to 'double'
1> There is no context in which this conversion is possible
error C3867: 'retirement::getinterest': function call missing argument list; use '&retirement::getinterest' to create a pointer to member
error C2440: '=' : cannot convert from 'double (__thiscall retirement::* )(void)' to 'double'
1> There is no context in which this conversion is possible
error C3867: 'retirement::getyears': function call missing argument list; use '&retirement::getyears' to create a pointer to member
error C2440: '=' : cannot convert from 'double (__thiscall retirement::* )(void)' to 'double'
1> There is no context in which this conversion is possible


quite frankly I'm not sure what I did wrong. I only tried to pass by reference because I figured passing by value would be a larger pain in the neck.

so what did I do wrong?
Perhaps you meant
14
15
16
17
R = j.getdollars();
m = j.getdeposits();
r = j.getinterest();
t = j.getyears();
?

Since it doesn't seem like you're modifying j, I would actually just go ahead and make it a const reference:
double mathfunction(const retirement& j)
Topic archived. No new replies allowed.