Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class test{
  4. protected:
  5. int field;
  6. test* next;
  7. public:
  8. test(int field);
  9. test(){;
  10. };
  11. ~test(){
  12. };
  13. static test* begin;
  14. static test* end;
  15. static void DelList();
  16. static void print();
  17. void add();
  18. virtual void show();
  19.  
  20. };
  21.  
  22. void test::add(){
  23. if (begin == NULL)
  24. { begin = this; end = this; this->next = NULL;}
  25. else { end->next = this; this->next = NULL; end = this;}
  26. };
  27.  
  28. void test::print(){
  29. test* cur; //current
  30. cur = begin;
  31. while(cur != 0){
  32. std::cout << "check" << std::endl;
  33. cur->show();
  34. cur = cur->next;
  35. }
  36. }
  37. //================
  38. class example : public test{
  39. protected:
  40. int year;
  41. public:
  42. example() : test(){year = 0;};
  43. ~example(){
  44. };
  45. void show();
  46. };
  47.  
  48.  
  49. static int boo;
  50.  
  51. int main(){
  52. test A;
  53. A.add();
  54. test::print();
  55. return 666;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement