Question

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'

Was it helpful?

Solution

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);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top