I am so lost its crazy, i have:
• Constructor: 2 argument
The 2-argument constructor takes a media and entertainment object as parameters. A copy should be made of the parameters through the createCopy function, if they are valid and stored in the current Entry object.
set up is as follows
Please help
• Constructor: 2 argument
The 2-argument constructor takes a media and entertainment object as parameters. A copy should be made of the parameters through the createCopy function, if they are valid and stored in the current Entry object.
set up is as follows
Code:
Entry::Entry():_media(NULL),_entertainment(NULL){}
Entry::Entry(const Entry& entry):_media(NULL),_entertainment(NULL)
{
}
Entry::Entry(const Media& media, const Entertainment& entertainment)
{
*_media = new Media();
Entertainment *_entertainment = entertainment.createCopy();
}
Entry::~Entry()
{
delete _media;
delete _entertainment;
}
Media * Entry::getMedia()
{
return _media;
}
const Media * Entry::getMedia() const
{
return _media;
}
Entertainment * Entry::getEntertainment()
{
return _entertainment;
}
const Entertainment * Entry::getEntertainment() const
{
return _entertainment;
}
bool Entry::isValid() const
{
return _media != NULL && _entertainment != NULL;
}
bool Entry::operator ==(const Entry& obj) const
{
if (getEntertainment()->getEntertainmentType() != obj.getEntertainment()->getEntertainmentType())
{
return false;
}
if (getMedia()->getMediaType() != obj.getMedia()->getMediaType())
{
return false;
}
if (getEntertainment()->getTitle() != obj.getEntertainment()->getTitle())
{
return false;
}
return true;
}
bool Entry::operator !=(const Entry& entry) const
{
return !(*this==entry);
}
Please help