Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Employee Header File
- //
- #ifndef MEDIA_H
- #define MEDIA_H
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- class Media
- {
- private:
- string title;
- string length;
- public:
- //***Constructors***
- Media();
- Media(string, string);
- Media(const Media &obj);
- //***destructor***
- ~Media();
- //***Mutators***
- void setTitle(string);
- void setLength(string);
- //***Accessors***
- string getTitle();
- string getLength();
- //Overloaded Operators
- Media operator = (const Media &);
- bool operator < (const Media &);
- bool operator > (const Media &);
- bool operator != (const Media &);
- bool operator == (const Media &right);
- };
- /*****Implimentation*********/
- //***Constructors***
- Media::Media()
- {
- title = " ";
- length = " ";
- }
- //***Constructors***
- Media::Media(string t, string l)
- {
- title = t;
- length = l;
- }
- //***Copy Constructor***
- Media::Media(const Media &obj)
- :
- title(obj.title),
- length(obj.length)
- {cout<<"Media Copy Constructor"<<endl;}
- Media::~Media()
- {
- cout<<"Media destructor"<<endl;
- }
- //***Mutators***
- void Media::setTitle(string t)
- {
- title = t;
- }
- void Media::setLength(string l)
- {
- length = l;
- }
- //***Accessors***
- string Media::getTitle()
- {
- return title;
- }
- string Media::getLength()
- {
- return length;
- }
- //***Overloades operators***
- Media Media::operator = (const Media &obj)
- {
- title = obj.title;
- length = obj.length;
- cout<<"Media copy assignment operator"<<endl;
- return *this;
- }
- bool Media::operator < (const Media &right)
- {
- bool status;
- if (title < right.title)
- status = true;
- else
- status = false;
- return status;
- }
- bool Media::operator > (const Media &right)
- {
- bool status;
- if (title > right.title)
- status = true;
- else
- status = false;
- return status;
- }
- bool Media::operator != (const Media &right)
- {
- bool status;
- if (*this == right)
- status = false;
- else
- status = true;
- return status;
- }
- bool Media::operator == (const Media &right)
- {
- bool status;
- if (title == right.title)
- status = true;
- else
- status = false;
- return status;
- }
- ostream &operator<<(ostream &strm, Media &obj)
- {
- strm <<"Media Title: "<< obj.getTitle() << "\n"
- <<"Media Length: "<< obj.getLength() <<endl;
- return strm;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement