小编Bet*_*ang的帖子

为什么我可以用指针赋予struct?

为什么甚至编译?

struct UE{
    UE(bool a = true) {  };
//  UE(){}; // if UE took no initial args and called below, gcc will complain.
};
class VA {
    protected:
            UE ue;
    public:
            VA();
};
VA::VA()
{
    ue = new UE(true); // ???why???
//  ue = new UE(); // will complain
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用gcc(GCC)4.6.2.如何使用指针分配结构?

c++ implicit-conversion

24
推荐指数
2
解决办法
602
查看次数

标签 统计

c++ ×1

implicit-conversion ×1