return value of constructor

Started by
29 comments, last by Conner McCloud 18 years, 1 month ago
Quote:Original post by Way Walker
Is there a rationale for not making them functions? Other languages (I know at least Smalltalk and Objective-C) use functions instead of something special.

They are functions, they're just special functions. In fact, that's the name of the chapter their described in: "Special Member Functions." Because of the way they're meant to be used, they are treated in a very unique way. There's really nothing more to it than that. Templated functions are treated differently than non-templated functions. Inlined functions, virtual functions. They all have their unique little rules. Constructors get initializer lists don't have a return value.

CM

This topic is closed to new replies.

Advertisement