How to call constructor without new?

后端 未结 4 786
夕颜
夕颜 2021-01-20 17:50

i know that string is like a class, and when creating a new string the string itself doesnt owe the value but only the value\'s pointer. but when creating a string there is

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-20 18:43

    You could have a method named createObject() and use that while having the constructors private, discourage their use.

提交回复
热议问题