ErrorOperator
ErrorOperator

Reputation: 51

Using the correct operand

I am trying to implement a system which gets a balance from an account, and minuses an amount given. Here is my method.

transaction withdraw(double amount, double ID){
Account Temp(NULL,NULL,NULL,NULL,NULL);

Temp = Llist.search(ID);  //Returns an Account Objet

Temp.setBalance(Temp.getBalance - amount); //Here is the error, '-' illegal, left operand   has type 'double (_thisCall Account::* )(void)'
string t = "Withdraw";

    transaction trans(t, amount, ID, name);
return trans;
}

I am asking which operand I would put into the line that would correctly minus 'a' from 'Temp.getbalance'

Upvotes: 0

Views: 87

Answers (1)

Will A
Will A

Reputation: 24988

Don't forget brackets for the function call - otherwise you're trying to take a double away from a function pointer!

Temp.setBalance(Temp.getBalance() - amount);

Upvotes: 3

Related Questions