Your program calls getGross, then getBonus...in getBonus, getGross is called again.

As a side note I'm not sure I understand how this code demonstrates inheritance, see What Is Inheritance? (The...