Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3. #include <string>
  4.  
  5. class A
  6. {
  7. public:
  8. std::string value;
  9. A() : value("okay") {}
  10. };
  11.  
  12. class B
  13. {
  14. public:
  15. void func(std::string v) { std::cout << v << std::endl; }
  16. };
  17.  
  18. int main()
  19. {
  20. A* pa = new A();
  21. B* pb = new B();
  22. std::list<A*> pal;
  23. std::list<B*> pbl;
  24. pal.push_back(pa);
  25. pbl.push_back(pb);
  26. std::list<A*>::iterator ia = pal.begin();
  27. std::list<B*>::iterator ib = pbl.begin();
  28. (*ib)->func((*ia)->value);
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement