fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <class T, int Size = 10>
  6. class Arr
  7. {
  8. public:
  9. Arr() {
  10. real = 0;
  11. buff = Size;
  12. }
  13.  
  14. template<int N>
  15. void merge(Arr<T, N>& arr);
  16.  
  17. int getSize() {
  18. return Size;
  19. }
  20.  
  21. private:
  22. int buff;
  23. int real;
  24. };
  25.  
  26. template<typename T, int Size>
  27. template<int N>
  28. void Arr<T, Size>::merge(Arr<T, N>& arr) {
  29. cout << "Everything is OK!" << arr.getSize();
  30. }
  31.  
  32.  
  33. int main()
  34. {
  35. Arr<int, 5> arr1;
  36. Arr<int, 500> arr2;
  37. arr1.merge(arr2);
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
Everything is OK!500