Advertisement
Khillz3000

Media.h

May 11th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. //Employee Header File
  2. //
  3. #ifndef MEDIA_H
  4. #define MEDIA_H
  5. #include "stdafx.h"
  6. #include <iostream>
  7. #include <iomanip>
  8. #include <string>
  9.  
  10. using namespace std;
  11.  
  12. class Media
  13. {
  14. private:
  15.  
  16. string title;
  17. string length;
  18.  
  19.  
  20. public:
  21.  
  22. //***Constructors***
  23. Media();
  24. Media(string, string);
  25. Media(const Media &obj);
  26. //***destructor***
  27. ~Media();
  28.  
  29. //***Mutators***
  30. void setTitle(string);
  31. void setLength(string);
  32.  
  33. //***Accessors***
  34. string getTitle();
  35. string getLength();
  36.  
  37. //Overloaded Operators
  38. Media operator = (const Media &);
  39. bool operator < (const Media &);
  40. bool operator > (const Media &);
  41. bool operator != (const Media &);
  42. bool operator == (const Media &right);
  43. };
  44.  
  45. /*****Implimentation*********/
  46. //***Constructors***
  47. Media::Media()
  48. {
  49. title = " ";
  50. length = " ";
  51. }
  52.  
  53. //***Constructors***
  54. Media::Media(string t, string l)
  55. {
  56. title = t;
  57. length = l;
  58. }
  59.  
  60. //***Copy Constructor***
  61. Media::Media(const Media &obj)
  62. :
  63. title(obj.title),
  64. length(obj.length)
  65. {cout<<"Media Copy Constructor"<<endl;}
  66.  
  67. Media::~Media()
  68. {
  69. cout<<"Media destructor"<<endl;
  70. }
  71.  
  72. //***Mutators***
  73. void Media::setTitle(string t)
  74. {
  75. title = t;
  76. }
  77.  
  78.  
  79. void Media::setLength(string l)
  80. {
  81. length = l;
  82. }
  83.  
  84. //***Accessors***
  85. string Media::getTitle()
  86. {
  87. return title;
  88. }
  89.  
  90. string Media::getLength()
  91. {
  92. return length;
  93. }
  94.  
  95. //***Overloades operators***
  96. Media Media::operator = (const Media &obj)
  97. {
  98. title = obj.title;
  99. length = obj.length;
  100. cout<<"Media copy assignment operator"<<endl;
  101. return *this;
  102. }
  103.  
  104.  
  105. bool Media::operator < (const Media &right)
  106. {
  107. bool status;
  108.  
  109. if (title < right.title)
  110. status = true;
  111.  
  112. else
  113. status = false;
  114.  
  115. return status;
  116. }
  117.  
  118. bool Media::operator > (const Media &right)
  119. {
  120. bool status;
  121.  
  122. if (title > right.title)
  123. status = true;
  124. else
  125. status = false;
  126.  
  127. return status;
  128. }
  129.  
  130. bool Media::operator != (const Media &right)
  131. {
  132. bool status;
  133.  
  134. if (*this == right)
  135. status = false;
  136. else
  137. status = true;
  138.  
  139. return status;
  140. }
  141.  
  142. bool Media::operator == (const Media &right)
  143. {
  144. bool status;
  145.  
  146. if (title == right.title)
  147. status = true;
  148.  
  149. else
  150. status = false;
  151.  
  152. return status;
  153. }
  154.  
  155.  
  156. ostream &operator<<(ostream &strm, Media &obj)
  157. {
  158. strm <<"Media Title: "<< obj.getTitle() << "\n"
  159. <<"Media Length: "<< obj.getLength() <<endl;
  160. return strm;
  161. }
  162. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement