Sunday, 10 December 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...