does not have class type C++

前端 未结 4 994
眼角桃花
眼角桃花 2021-02-02 13:28

This is one class from my program! When I\'m trying to compile the whole program, I get an error message like this:

main.cpp:174: error: \'((Scene*)this)

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 14:30

    You declare lake as a method that takes one argument and returns a Lake. You then try and call a method on it via lake.light_up(). This causes the error you observe.

    To solve the problem, you either need to declare lake to be a variable, e.g. Lake lake;, or you need to stop trying to call a method on it.

提交回复
热议问题