Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #ifndef ACTIVITY_H
  2. #define ACTIVITY_H
  3. #include "Event.h"
  4. #include <string>
  5. using namespace std;
  6.  
  7. class Activity : Event
  8. {
  9. private:
  10. string m_location;
  11. public:
  12.  
  13. Activity(string id, string month, string day, string year, string description, string location) : Event(id, month, day, year, description)
  14. {
  15. m_location = location;
  16. }
  17.  
  18. string display()
  19. {
  20. if (m_location == "")
  21. return Event::display();
  22. else
  23. return Event::display() + " (" + m_location + ")";
  24. }
  25.  
  26. bool contains(std::string s)
  27. {
  28. string data = m_description + " " + m_location;
  29.  
  30. std::transform(data.begin(), data.end(), data.begin(), ::tolower);
  31. std::transform(s.begin(), s.end(), s.begin(), ::tolower);
  32.  
  33. return (data.find(s) != std::string::npos);
  34. }
  35.  
  36. string getID()
  37. {
  38. return m_id;
  39. }
  40.  
  41. bool hasId(std::string id)
  42. {
  43. return (id == m_id);
  44. }
  45. };
  46.  
  47. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement