Inheritance / Aggregation
Posted on 2004-04-15
The Publisher is a part of the BookItem.
The user defined constructor in the Publisher class is initialised in the call to the user defined constructor in the BookItem class . The constructor in Publisher takes a const string object and included in the call in main. I have written the user defined constructor in the BookItem class but its not correct - obviously I get 'type expected' compile errors.
Can someone please help me?
I have included the main parts of the code.
Publisher::Publisher(const string &Name) : Name(Name)
//main file - initialise the constructor in the BooKItem.cpp file
BookItem text1("W. Savitch", "Absolute C++ 1/e", Publisher("Addison/Wesley"), 2002);
//BookItem Class - Is this correct?
BookItem::BookItem(string Authors = "", string Title = "", Publisher(const string &theName),int Year = 0)
this->SetPublisher(Publisher(const string &theName));