What is a static constructor?

后端 未结 13 1872
天涯浪人
天涯浪人 2020-11-27 03:46

This question was asked to me in an interview:

What is a static constructor?

Does it exist in C++? If yes, please explain it wit

13条回答
  •  醉酒成梦
    2020-11-27 04:10

    There is no such thing in C++. Constructors and destrcutors typically used to create or destruct instance of object. It's meaningless to call them without corresponding object instance. You can emulate them using a singleton pattern.

提交回复
热议问题