Recursive Constructor Invocation

前端 未结 3 1663
执笔经年
执笔经年 2020-12-11 10:16
public class LecturerInfo extends StaffInfo {

    private float salary;

    public LecturerInfo()
    {
        this();
        this.Name = null;
        this.Addr         


        
3条回答
  •  天命终不由人
    2020-12-11 11:04

    if you modify the fist constructor to this:

     public LecturerInfo()
     {
       this(null, null, (float)0.0);
     }
    

    this will be recursive.

提交回复
热议问题