Skip to content

Instantly share code, notes, and snippets.

@TheNerdyHamster
Created July 19, 2018 20:05
Show Gist options
  • Save TheNerdyHamster/622324ace38e08b8a2b6810cd9c235ae to your computer and use it in GitHub Desktop.
Save TheNerdyHamster/622324ace38e08b8a2b6810cd9c235ae to your computer and use it in GitHub Desktop.
Special Templates
#include <iostream>
using namespace std;
template <class T>
class noChar{
public:
noChar(T x){
cout << x << " is not a character!" << endl;
}
};
template <>
class noChar<char>{
public:
noChar(char x){
cout << x << " is indeed a character!" << endl;
}
};
int main() {
noChar <int> nObj(45);
noChar noChar1('d');
noChar <char> noChar2('d');
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment