Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <stdexcept>
- #include <string>
- using namespace std;
- template<typename T1, typename T2, typename T3>
- class Triple
- {
- public:
- T1 a;
- T2 b;
- T3 c;
- ~Triple()
- {
- cout << "wywolujemy destruktor" << endl;
- }
- Triple(T1 one, T2 two, T3 three)
- {
- this->a = one;
- this->b = two;
- this->c = three;
- }
- void one()
- {
- cout << "piewrszy el: " << this->a << endl;
- }
- void two()
- {
- cout << "drugi el: " << this->b << endl;
- }
- void three()
- {
- cout << "trzeci el: " << this->c << endl;
- }
- };
- int main()
- {
- int x = 5;
- char y = 'a';
- double z = 1.8;
- Triple <int, char, double> obj(x, y, z);
- obj.one();
- obj.two();
- obj.three();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment