My question is what does a constructor return? This question is not quite different from "What is the return type of a constructor?"
I have read somewhere that a constructor returns a complete object implicitly (i.e implicit return type is the name of the class) but it shall not be specified explicitly.
struct empty{};
int main(){
empty(); //creates a temporary and implicitly a constructor is called
}
So as per my interpretation the implicit return type should be the name of the class, in this case empty
. Is my wild interpretation correct?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…