Calling a constructor to re-initialize object

前端 未结 12 1745
执笔经年
执笔经年 2020-12-04 15:01

is it possible to re-initialize an object of a class using its constructor?

12条回答
  •  -上瘾入骨i
    2020-12-04 15:36

    Sort of. Given a class A:

    A a;
    ...
    a = A();   
    

    the last statement is not initialisation, it is assignment, but it probably does what you want.

提交回复
热议问题