fork download
  1. #include <iostream>
  2. #include <list>
  3.  
  4.  
  5. class Record{};
  6.  
  7. class RecordDer : public Record{};
  8.  
  9.  
  10. template<typename Record>
  11. class List
  12. {
  13. std::list<Record*> l_;
  14. public:
  15. int init(){return 0;};
  16. };
  17.  
  18.  
  19. class ListDer : List<RecordDer>
  20. {
  21. };
  22.  
  23. using namespace std;
  24.  
  25. int main() {
  26.  
  27. ListDer l;
  28. l.init();
  29.  
  30. return 0;
  31. }
Compilation error #stdin compilation error #stdout 0.01s 2720KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15: error: ‘int List<Record>::init() [with Record = RecordDer]’ is inaccessible
prog.cpp:28: error: within this context
prog.cpp:28: error: ‘List<RecordDer>’ is not an accessible base of ‘ListDer’
stdout
Standard output is empty