fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<class T = int>
  5. struct A {
  6. using Int = T;
  7. virtual void pr() {
  8. cout << "A fire\n";
  9. }
  10. };
  11. template<class T>
  12. struct B : public A<T> {
  13. virtual void pr() override {
  14. Int a;
  15. cout << "B fire\n";
  16. }
  17. };
  18.  
  19. int main() {
  20. A<>* b = new B<int>();
  21. A<>* c = b;
  22. delete b;
  23. c->pr();
  24. // your code goes here
  25. return 0;
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘virtual void B<T>::pr()’:
prog.cpp:14:3: error: ‘Int’ was not declared in this scope
   Int a;
   ^~~
stdout
Standard output is empty