Guest User

Untitled

a guest
Jul 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <opencv2/opencv.hpp>
  2.  
  3. // Forward declaration
  4. class foo;
  5.  
  6. class bar
  7. {
  8. public:
  9. bar() { }
  10. void link(cv::Ptr<foo> foo_in);
  11.  
  12. private:
  13. cv::Ptr<foo> f;
  14. };
  15.  
  16. class foo
  17. {
  18. public:
  19. foo() { }
  20. void link(cv::Ptr<bar> bar_in);
  21.  
  22. private:
  23. cv::Ptr<bar> b;
  24. };
  25.  
  26. void bar::link(cv::Ptr<foo> foo_in) {
  27. if (f != foo_in) {
  28. f = foo_in;
  29. f->link(cv::Ptr<bar>(this));
  30. }
  31. }
  32.  
  33. void foo::link(cv::Ptr<bar> bar_in) {
  34. if (b != bar_in) {
  35. b = bar_in;
  36. b->link(cv::Ptr<bar>(this));
  37. }
  38. }
  39.  
  40.  
  41. int main(int argc, char** argv)
  42. {
  43. cv::Ptr<foo> f = new foo();
  44. cv::Ptr<bar> b = new bar();
  45.  
  46. f->link(b);
  47. //b->link(f);
  48.  
  49. return 0;
  50. }
  51.  
  52. Unhandled exception ... Access violation reading location ...
Add Comment
Please, Sign In to add comment