#include <iostream>
#include <string>
using namespace std; // To mi się nie podoba!
template<typename Typ1,typename Typ2>class Hello {
public:
Typ1 a;
Typ2 b;
Hello(Typ1 _a, Typ2 _b) {
a = _a;
b = _b;
}
void oblicz();
};
template<typename Typ1, typename Typ2>
void Hello<Typ1, Typ2>::oblicz() {
cout << a << " default " << b << endl;
}
template<>
void Hello<std::string, std::string>::oblicz() {
cout << a << " string " << b << endl;
}
int main() {
// C++17 poprawna dedukcja typu...
//auto hello1 = Hello(std::string("ala"), std::string("kot"));
//
// C++11 niestety tak...
auto hello1 = Hello<std::string, std::string>(std::string("ala"), std::string("kot"));
hello1.oblicz();
auto hello2 = Hello<int, int>(1, 2);
hello2.oblicz();
}