Inheritance not working

前端 未结 4 1603
伪装坚强ぢ
伪装坚强ぢ 2021-01-17 06:29

From my code I want my bedroom class to inherit length and breadth from the superclass - room. I have filled the errors in the respective lines within comments. I am getting

4条回答
  •  温柔的废话
    2021-01-17 07:31

    Your BedRoom class has a pseudo-constructor not a real constructor. Constructors don't return anything, not void not anything. Get rid of that void statement.

    Change

    public void Bedroom(int x,int y,int z)
    

    to

    public BedRoom(int x,int y,int z) // also capitalize correctly
    

提交回复
热议问题