Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Why can't PODs have constructors?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="BobR, post: 2991072"] JohnQ wrote in message... struct MyRect2{ // test compiler supplied default Ctor long x, y; MyRect2( long x1, long y1 ): x(x1), y(y1){} // MyRect2( long x1=0, long y1=0 ): x(x1), y(y1){} // no error // (only (un-)comment one at a time)(or comment both to test) }; MyRect2 Rect2; // error: no matching function for call to `MyRect2::MyRect2()' // error: candidates are: MyRect2::MyRect2(const MyRect2&) // : MyRect2::MyRect2(long int, long int) MyRect2 Rect2a(1,2); // ok (either Ctor shown ) So, that shows you that once *you* declare/define anything that can be taken as a constructor, the compiler will *not* supply one. Try it, experiment. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Why can't PODs have constructors?
Top