Created
May 19, 2016 13:34
-
-
Save hunandy14/a7062a5f645a18f8f606dc9ddb0f7ddc to your computer and use it in GitHub Desktop.
無法編譯
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
/********************************************************** | |
Name : sourse.cpp | |
Date : 2016/05/19 | |
By : CharlotteHonG | |
Final: 2016/05/19 | |
**********************************************************/ | |
#include <iostream> | |
/*=======================================================*/ | |
using namespace std; | |
int element[] = {5, -2, 4}; | |
template <typename T1, typename T2> | |
class Demo { | |
public: | |
Demo<T1, T2>(const T1 &p, const T2 &n); | |
T1 ptr; | |
T2 len; | |
}; | |
template <typename T1, typename T2> | |
Demo<T1, T2>::Demo<T1, T2>(const T1 &p, const T2 &n) { | |
this->ptr = p; | |
this->len = n; | |
} | |
int main(int argc, char const *argv[]) { | |
Demo<int*, int> arr(element, 3); | |
cout << "arr = " << arr.len << endl; | |
system("PAUSE"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment