fork download
  1. class simpleList {
  2.  
  3. public:
  4. //Returns a pointer to the first Elem of the list
  5. simpleList::Elem* front();
  6.  
  7. //Returns a pointer to the last Elem of the list
  8. simpleList::Elem* back();
  9.  
  10. private:
  11. struct Elem {
  12. char info;
  13. Elem *next;
  14. };
  15.  
  16. Elem *head;
  17. };
  18.  
  19. //Returns a pointer to the first Elem of the list
  20. simpleList::Elem* simpleList::front()
  21. {
  22. return head;
  23. }
  24.  
  25. //Returns a pointer to the last Elem of the list
  26. simpleList::Elem* simpleList::back()
  27. {
  28. Elem * temp = head;
  29.  
  30. while( temp -> next != 0 )
  31. temp = temp -> next;
  32.  
  33. return temp;
  34. }
  35.  
  36. int main() {
  37. return 1;
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5: error: ISO C++ forbids declaration of ‘Elem’ with no type
prog.cpp:5: error: extra qualification ‘simpleList::’ on member ‘Elem’
prog.cpp:5: error: expected ‘;’ before ‘*’ token
prog.cpp:8: error: ISO C++ forbids declaration of ‘Elem’ with no type
prog.cpp:8: error: extra qualification ‘simpleList::’ on member ‘Elem’
prog.cpp:8: error: expected ‘;’ before ‘*’ token
prog.cpp:20: error: no ‘simpleList::Elem* simpleList::front()’ member function declared in class ‘simpleList’
prog.cpp:11: error: ‘struct simpleList::Elem’ is private
prog.cpp:20: error: within this context
prog.cpp:26: error: no ‘simpleList::Elem* simpleList::back()’ member function declared in class ‘simpleList’
prog.cpp:11: error: ‘struct simpleList::Elem’ is private
prog.cpp:26: error: within this context
stdout
Standard output is empty