fork(1) download
  1. #include <iostream>
  2.  
  3. template< class N >
  4. class A {
  5. public:
  6. template< class M >
  7. void fun(N n, M m) {
  8. std::cout << "Hello World! " << n << " " << m << std::endl;
  9. }
  10. };
  11.  
  12. template< class N, class M >
  13. class B {
  14. public:
  15. void fun(N n, M m) {
  16. A< N > a; // Почему если здесь вместо N написать int, то все нормально, а если как есть то ошибка?
  17. a.fun(n, m);
  18. }
  19. };
  20.  
  21. int main() {
  22. B< int, int > b;
  23. b.fun(1, 2);
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5508KB
stdin
Standard input is empty
stdout
Hello World! 1 2