これは、リスト クラスのノードのコンストラクタです。初期化リストの別のクラスである winery のディープ コピーを作成する必要があります。アイテムはワイナリーのインスタンスです。
List::Node::Node(const Winery& winery) :
item(winery)
// your initialization list here
{
Winery w = winery;
item = w;
}
ワイナリーのコンストラクター:
Winery::Winery(const char * const name, const char * const location,
const int acres, const int rating) :
name(name),
location(location),
acres(acres),
rating(rating)
{
char *nm = new char[strlen(name) + 1];
char *loc = new char[strlen(location) + 1];
strcpy(nm, this->name);
strcpy(loc, this->location);
this->name = nm;
this->location = loc;
this->acres = acres;
this->rating = rating;
}