Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template<class T>
- class Airplane
- {
- public:
- Airplane(T x)
- {
- cout << x << " is not a character." << endl;
- }
- };
- template<>
- class Airplane<char>
- {
- public:
- Airplane(char x)
- {
- cout << x << " is indeed a character." << endl;
- }
- };
- int main()
- {
- Airplane<int> obj1(7);
- Airplane<double> obj2(3.154);
- Airplane<char> obj3('A');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement