On Mon, Aug 4, 2008 at 11:52 AM, Brett McCoy <[EMAIL PROTECTED]> wrote:
>> I thought new and structs were not to be used together. I have Googled >> the question and in C# there is a member function called new in a >> struct class but that is not using the keyword "new" and assigning a >> struct. It's also OT here as we are discussing C/C++. Am I wrong about >> new and struct or is that the point of the message? > > For simple structs, you can use new (it will use a 'default' > constructor if one is not provided). In C++, structs are like classes > except structs default to public access whereas classes default to > private access. This isn't entirely clear the way I worded it -- I mean to say that new can be used with structs, but for simple structs, a default constructor will be used. For more complex structs, a constructor should be written or some other method is needed to properly initialize the data. It's just like with classes -- be careful if you are relying in the default constructor to be created for you. -- Brett ------------------------------------------------------------ "In the rhythm of music a secret is hidden; If I were to divulge it, it would overturn the world." -- Jelaleddin Rumi
