new a typedefed struct

V

Vincent SHAO

There is a struct:

struct _point{
int x;
int y;
};
typedef _point Point;

struct _queue_node{
Point coordinate;
struct _queue_node* next;
};
typedef struct _queue_node Node;
typedef struct _queue_node* pNode;

Why i can't new a Node:
pNode n=new Node(); //error:no appropriate default constructor
available
i can only pNode n=new _queue_node();
Thank you
 
V

Vincent SHAO

* Vincent SHAO:



In C++ just write

struct Point { int x, y; };


In C++ just write

struct Node
{
Point coordinate;
Node* next;
};


Mysterious. Which compiler & version of that compiler are you using?
Academically it could be due to your use of names with leading underscores,
however, in practice I very much doubt that.

Cheers, & hth.,

- Alf

Great thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top