Advertisement
Smudla

Templates Cpp

Jun 2nd, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #ifndef TEMPLATE_LIBRARY_H
  2. #define TEMPLATE_LIBRARY_H
  3. #include <string>
  4.  
  5. struct Papper;
  6. template<class T>
  7. class Record;
  8. template<typename T>
  9. std::ostream& operator<<(std::ostream& os, const Record<T>& record){
  10.     os << record.Object;
  11.     return os;
  12. }
  13. template<typename T>
  14. class Record{
  15. protected:
  16.     T Object;
  17.     size_t Count;
  18.     friend std::ostream& operator<< <>(std::ostream& os, const Record<T>& record);
  19. public:
  20.     T GetObject() const;
  21.     template<class U>
  22.     void TemplateMethod(const U& data);
  23. };
  24. template<typename T>
  25. template<class U>
  26. void Record<T>::TemplateMethod(const U& data){
  27.  
  28. }
  29.  
  30.  
  31. template<typename T>
  32. T Record<T>::GetObject()const{
  33.     return Object;
  34. }
  35.  
  36. struct Papper{
  37.     std::string Format;
  38.     std::string Color;
  39. };
  40. std::ostream& operator<<(std::ostream& os, const Papper& paper){
  41.     os << paper.Format << "" << paper.Color;
  42.     return os;
  43. }
  44.  
  45. //template<typename T>
  46. //std::ostream& operator<<(std::ostream& os, const Record<T>& record){
  47. //  os << record.Object;
  48. //  return os;
  49. //}
  50.  
  51.  
  52. #endif //TEMPLATE_LIBRARY_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement