Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Vreau sa pot face client.create_information<int>(3) sau client.creare_information<string>("Ana are mere") si asta sa
- //imi instantieze un obiect de tipul informatie_numar si informatie_text
- // 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"
- #include <iostream>
- using namespace std;
- template <class generic>
- class client
- {
- public:
- void stocare(generic a); //2
- };
- void client:: stocare(generic a)
- {
- information inf(a); //3
- }
- void stocare_info(client c, generic b) //1
- {
- c.stocare(b); // 1 apeleaza 2 care apeleaza 3
- }
- class information
- {
- information(generic a); //poate folosind constructorul parametrizat generic pot face asta
- };
- class information_text :public information;
- class information_string :public information;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement