Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. #ifndef DATA_H_
  2. #define DATA_H_
  3.  
  4. class List;
  5. class Data {
  6. public:
  7. Data();
  8. Data(int aID);
  9. virtual ~Data();
  10. virtual int getID();
  11. virtual void setID(int aID);
  12. private:
  13. int ID;
  14. List *listOne;
  15. List *listTwo;
  16. };
  17.  
  18. #endif /* DATA_H_ */
  19.  
  20. #include "Data.h"
  21. #include "List.h"
  22.  
  23. Data::Data() {
  24. listOne = new List();
  25. listTwo = new List();
  26. Data::ID = 0;
  27. }
  28.  
  29. Data::Data(int aID) {
  30. Data::listOne = new List();
  31. Data::listTwo = new List();
  32. Data::ID = aID;
  33. }
  34.  
  35. Data::~Data() {
  36. delete(listOne);
  37. delete(listTwo);
  38. }
  39.  
  40. int Data::getID() {
  41. return Data::ID;
  42. }
  43.  
  44. void Data::setID(int aID) {
  45. Data::ID = ID;
  46. }
  47.  
  48. ..Data.cpp: In constructor 'Data::Data()':
  49. ..Data.cpp:12:23: error: invalid use of incomplete type 'class List'
  50. listOne = new List();
  51. ^
  52. In file included from ..Data.cpp:8:0:
  53. ..Data.h:11:7: note: forward declaration of 'class List'
  54. class List;
  55. ^
  56. ..Data.cpp:13:22: error: invalid use of incomplete type 'class List'
  57. listTwo = new List();
  58. ^
  59. In file included from ..Data.cpp:8:0:
  60. ..Data.h:11:7: note: forward declaration of 'class List'
  61. class List;
  62. ^
  63. ..Data.cpp: In constructor 'Data::Data(int)':
  64. ..Data.cpp:18:29: error: invalid use of incomplete type 'class List'
  65. Data::listOne = new List();
  66. ^
  67. In file included from ..Data.cpp:8:0:
  68. ..Data.h:11:7: note: forward declaration of 'class List'
  69. class List;
  70. ^
  71. ..Data.cpp:19:28: error: invalid use of incomplete type 'class List'
  72. Data::listTwo = new List();
  73. ^
  74. In file included from ..Data.cpp:8:0:
  75. ..Data.h:11:7: note: forward declaration of 'class List'
  76. class List;
  77. ^
  78. ..Data.cpp: In destructor 'virtual Data::~Data()':
  79. ..Data.cpp:24:18: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
  80. delete(listOne);
  81. ^
  82. ..Data.cpp:24:18: warning: invalid use of incomplete type 'class List'
  83. In file included from ..Data.cpp:8:0:
  84. ..Data.h:11:7: note: forward declaration of 'class List'
  85. class List;
  86. ^
  87. ..Data.cpp:24:18: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
  88. delete(listOne);
  89. ^
  90. ..Data.cpp:25:17: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
  91. delete(listTwo);
  92. ^
  93. ..Data.cpp:25:17: warning: invalid use of incomplete type 'class List'
  94. In file included from ..Data.cpp:8:0:
  95. ..Data.h:11:7: note: forward declaration of 'class List'
  96. class List;
  97. ^
  98. ..Data.cpp:25:17: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
  99. delete(listTwo);
  100.  
  101. ..Data.h:25:2: error: 'List' does not name a type
  102. List *cpubursts;
  103. ^
  104. ..Data.h:26:2: error: 'List' does not name a type
  105. List *iobursts;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement