Constructor is static or non static

后端 未结 11 1557
青春惊慌失措
青春惊慌失措 2021-02-04 12:33

As per standard book constructor is a special type of function which is used to initialize objects.As constructor is defined as a function and inside class function can have on

11条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 13:22

    Constructors are NOT static functions. When you do Test test =new Test(); a new Test object is created and then the constructor is called on that object (I mean this points to the newly created object).

提交回复
热议问题