Skip to content

Instantly share code, notes, and snippets.

@hunandy14
Created May 19, 2016 13:34
Show Gist options
  • Save hunandy14/a7062a5f645a18f8f606dc9ddb0f7ddc to your computer and use it in GitHub Desktop.
Save hunandy14/a7062a5f645a18f8f606dc9ddb0f7ddc to your computer and use it in GitHub Desktop.
無法編譯
/**********************************************************
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