error: expected class-name before ‘{’ token

前端 未结 5 699
独厮守ぢ
独厮守ぢ 2020-11-30 05:41

I know there are a couple of similar questions(circular include) out stackoverflow and other websites. But I still can\'t figure it out and no solutions pop out. So I would

5条回答
  •  隐瞒了意图╮
    2020-11-30 06:11

    I know it is a bit late to answer this question, but it is the first entry in google, so I think it is worth to answer it.

    The problem is not a coding problem, it is an architecture problem.

    You have created an interface class Event: public Item to define the methods which all events should implement. Then you have defined two types of events which inherits from class Event: public Item; Arrival and Landing and then, you have added a method Landing* createNewLanding(Arrival* arrival); from the landing functionality in the class Event: public Item interface. You should move this method to the class Landing: public Event class because it only has sense for a landing. class Landing: public Event and class Arrival: public Event class should know class Event: public Item but event should not know class Landing: public Event nor class Arrival: public Event.

    I hope this helps, regards, Alberto

提交回复
热议问题