Monday, 28 August 2017

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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...