Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // Vreau sa pot face client.create_information<int>(3) sau client.creare_information<string>("Ana are mere") si asta sa
  2. //imi instantieze un obiect de tipul informatie_numar si informatie_text
  3. // Cum ar trebui sa fac sa pot folosi o functia stocare_info, si bazat pe ce tip de date e b sa fie creat un obiect de tipul "information_"tipul lui b"
  4.  
  5.  
  6.  
  7. #include <iostream>
  8. using namespace std;
  9. template <class generic>
  10. class client
  11. {
  12. public:
  13. void stocare(generic a); //2
  14. };
  15. void client:: stocare(generic a)
  16. {
  17. information inf(a); //3
  18. }
  19.  
  20. void stocare_info(client c, generic b) //1
  21. {
  22. c.stocare(b); // 1 apeleaza 2 care apeleaza 3
  23. }
  24.  
  25. class information
  26. {
  27. information(generic a); //poate folosind constructorul parametrizat generic pot face asta
  28.  
  29. };
  30.  
  31. class information_text :public information;
  32. class information_string :public information;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement