fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <typename T>
  6. class Node
  7. {
  8. T* m_data;
  9. Node* next;
  10. public:
  11. Node(T*, Node<T>*);
  12. ~Node();
  13. void Delete (Node<T>* head);
  14. };
  15.  
  16. template <typename T>
  17. Node<T>::Node(T* n, Node<T>* head)
  18. {
  19. this->m_data = n;
  20. this->next=head;
  21. }
  22.  
  23. template <typename T>
  24. Node<T>::~Node()
  25. {
  26. }
  27.  
  28. template <typename T>
  29. void Node<T>::Delete(Node<T>* head)
  30. {
  31. while(head)
  32. {
  33. delete(head->m_data);
  34. //head->m_data->~data();
  35. head=head->next;
  36. }
  37. }
  38.  
  39. int main() {
  40. Node<int> x(0,0);
  41. return 0;
  42. }
Success #stdin #stdout 0.02s 2676KB
stdin
Standard input is empty
stdout
Standard output is empty