Error 1 Operator '*' cannot be applied to operands of type 'method group' and 'double'

前端 未结 5 1873
难免孤独
难免孤独 2021-01-25 19:11

I believe what i am trying to do is very simple but I get the error. Operator \'*\' cannot be applied to operands of type \'method group\' and \'double\'

I want to mult

5条回答
  •  半阙折子戏
    2021-01-25 19:16

    You are missing the paranthesis from your function call to dayrental, which is causing the compiler to think you are refering to the method itself rather than the result of a call to that method.

    rental = dayrental * 19.95;
    

    should be

    rental = dayrental() * 19.95;
    

提交回复
热议问题