Thursday, April 18, 2019

No Appropriate Default Constructor For Node struct (C++ Syntax)

No error




// list.h
//...
list::node::node(const winery &winery)

{
}
void list::insert(const winery& winery)
{
//const char *Names = winery.getName();
node *new_node = new node( winery );
}


Adding the list::node::node(const winery &winery ) function

to the list.cpp file enables allocation of the node.



however, it forces me to add a dfault constructor to the winery class:




class winery
{
public :
winery(const char * const name, const char * const location,
const int acrces, const int rating);

winery();
virtual ~winery(void);
//...


And thereby havinvg to provide the body of the default ctor.
Is there a way to have it work without declaring and defining a default ctor to the winery class?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...