Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using std::string;
- template<typename T>
- void func(T &arg)
- {
- arg += 'X';
- }
- template<>
- void func(int &arg)
- {
- arg += 11;
- }
- int main()
- {
- string str("asdf");
- func(str);
- std::cout << str << std::endl;
- int num = 1326;
- func(num);
- std::cout << num << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement