Initialisation of Objects Syntax question
Posted
by Brock Woolf
on Stack Overflow
See other posts from Stack Overflow
or by Brock Woolf
Published on 2010-05-15T08:15:01Z
Indexed on
2010/05/15
8:34 UTC
Read the original article
Hit count: 278
c++
|initialization
When I initialise a struct in C (Node is the struct):
struct Node
{
/* Non-Relevant code */
};
This works:
Node *rootNode = new Node();
but so does this:
Node *rootNode = new Node;
Is there a difference, and what is the difference between using ()
or not using the brackets?
Just off memory, I think the same applies above for C++ object initialisations. What is happening here?
© Stack Overflow or respective owner