Hi i am so lost and stressed please can some help me. My question is how do i code the follwoing
• Constructor: Copy The copy constructor should check the validity of the Entry object parameter through the use of the isValid method and copy the valid objects media and entertainment objects through the use of the createCopy functions.
• 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.
Entry class
Entry::Entry():_media(NULL),_entertainment(NULL){}
Entry::Entry(const Entry& entry):_media(NULL),_entertainment(NULL)
{
}
Entry::Entry(const Media& media, const Entertainment& entertainment)
{
}
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);
}
Entry header file
class Entry
{
Entertainment *_entertainment;
Media *_media;
public: