C++ Constructors have no return type. Just exactly why?

前端 未结 8 881
孤独总比滥情好
孤独总比滥情好 2021-01-04 14:00

I\'ve Googled this and read many posts, but there are so many different answers that all make logical sense that I was wondering if an expert on the topic could demystify th

8条回答
  •  旧巷少年郎
    2021-01-04 14:04

    Constructors aren't called like other functions, so they don't return like other functions. They execute as a side-effect of certain constructs (cast, new, variable definition, ctor-initializer-list, pass-by-value, return-by-value).

提交回复
热议问题