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="James Kanze, post: 2990763"] Once constructed, yes. The difference is in the construction: a POD is an agglomerate (although not all agglomerates are POD's), and uses agglomerate initialization syntax, e.g.: Point z = { 1, 2 } ; Especially useful, of course, is the fact that a POD can be statically initialized (and so is exempt from order of initialization issues). A POD can also be a member of a union. The basic idea behind this, of course, is that if there is a user defined constructor (actually, if there is a non-trivial constructor), the compiler will call it, anytime there is an object of the type. Calling it means that initialization is no longer static, and having to call it means that the object cannot be a member of a union (since the compiler cannot know a priori which constructor to call). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Why can't PODs have constructors?
Top