VEndymionV

Untitled

Jan 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "Animal.h"
  3. #include "Compare.h"
  4.  
  5. Compare::Compare()
  6. {
  7. }
  8.  
  9. bool Compare::sortByName(Animal * first, Animal * second)
  10. {
  11.     return (first->getName() < second->getName());
  12. }
  13.  
  14. bool Compare::sortByID(Animal * first, Animal * second)
  15. {
  16.     return (first->getID() < second->getID());
  17. }
  18.  
  19. bool Compare::search(Animal * first, Animal * second)
  20. {
  21.     return (first->getID() == second->getID());
  22. }
  23.  
  24. Compare::cmpByID::cmpByID(const int ID)
  25.     :ID(ID)
  26. {
  27.    
  28. }
  29.  
  30. bool Compare::cmpByID::operator()(const Animal * first) const
  31. {
  32.     return (first->getID() == ID);
  33. }
  34.  
  35. Compare::cmpByName::cmpByName(std::string const & name)
  36.     : Name(name)
  37. {
  38. }
  39.  
  40. bool Compare::cmpByName::operator()(const Animal * first) const
  41. {
  42.     return (first->getName() == Name);
  43. }
  44.  
  45. Compare::~Compare()
  46. {
  47. }
Advertisement
Add Comment
Please, Sign In to add comment