Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Class CD Header File
- //
- #ifndef CD_H
- #define CD_H
- #include "stdafx.h"
- #include "LinkList.h"
- #include "Media.h"
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- //LinkList structure for CD class
- struct CdContence
- {
- string song;
- string length;
- };
- class CD : public Media
- {
- public:
- LinkList<CdContence> Cd;
- public:
- //***Constructors***
- CD(string, string);
- CD();
- CD(const CD &obj);
- CD operator = (const CD &);
- //***destructor***
- ~CD();
- //***Mutators***
- void setCD(string, string, string, string);
- //***Accessors***
- LinkList<CdContence> getCD();
- //Overloaded Operators
- bool operator < (CD &);
- bool operator > (CD &);
- bool operator != (CD &);
- bool operator == (CD &);
- };
- /*****Implimentation*********/
- //***Constructors***
- CD::CD(string T, string L) : Media(T, L)
- {
- cout<<"CD CONSTRUCTOR2"<<endl;
- }
- CD::CD() : Media()
- {
- cout<<"CD CONSTRUCTOR"<<endl;
- }
- //CD::CD(const CD &obj) :Media(obj)
- //{
- //
- // Cd = obj.Cd;
- //
- //}
- CD::CD(const CD &obj)
- :Media(obj),
- Cd(obj.Cd)
- {}
- //****=Destructor***
- CD::~CD()
- {
- cout<<"CD destructor"<<endl;
- }
- //***Mutators***
- void CD::setCD (string T, string L,string s, string l)
- {
- setTitle(T);
- setLength(L);
- CdContence temp;
- temp.song = s;
- temp.length = l;
- Cd.appendNode(temp);
- }
- //***Accessors***
- LinkList<CdContence> CD::getCD()
- {
- return Cd;
- }
- //***Overloaded operators***
- CD CD::operator = (const CD &obj)
- {
- Media::operator=(obj);
- Cd = obj.Cd;
- cout<<" CD Assignment operator called "<<endl;
- return *this;
- }
- bool CD::operator < (CD &right)
- {
- bool status;
- if (getTitle() < right.getTitle())
- status = true;
- else
- status = false;
- return status;
- }
- bool CD::operator > (CD &right)
- {
- bool status;
- if (getTitle() > right.getTitle())
- status = true;
- else
- status = false;
- return status;
- }
- bool CD::operator != (CD &right)
- {
- bool status;
- if (*this == right)
- status = false;
- else
- status = true;
- return status;
- }
- bool CD::operator == (CD &right)
- {
- bool status;
- if (getTitle() == right.getTitle())
- status = true;
- else
- status = false;
- return status;
- }
- ostream &operator<<(ostream &strm, CD &obj)
- {
- strm
- <<"CD Title: "<< obj.getTitle() << "\n"
- <<"CD Length: "<< obj.getLength()<< "\n"
- <<endl;
- return strm;
- obj.Cd.displayList();
- }
- ostream &operator<<(ostream &strm, CdContence &obj)
- {
- strm
- <<"Song Title: "<< obj.song << "\n"
- <<"Song Length: "<< obj.length << "\n"
- <<endl;
- return strm;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement