-
-
Save jitpaul/5754d02d63437de25e01410784951bbc to your computer and use it in GitHub Desktop.
Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template <int min, int max> | |
class ExampleClass { | |
}; | |
int main() { | |
/*Incorrect usage of non-type parameters. They should be known at compile time.*/ | |
int min1, max1; | |
cin >> min1; cin >> max1; | |
ExampleClass<min1, max1> ec1; | |
/*Correct Usage non-type parameters.*/ | |
ExampleClass<0, 10> ec2; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment