gpt4 book ai didi

c++ - 如何将字符串转换为类名

转载 作者:太空宇宙 更新时间:2023-11-04 15:09:25 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
C++: instantiate class from name?

例如,如果我有

string s = "myObject";

那么我如何使用那个 String 来制作这个呢?

return new myObject();

我试过这个,但它很傻而且是错误的

return new s();

谢谢

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com