Advertisement
Guest User

Untitled

a guest
Feb 9th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #import "Bcpp.h"
  2. #import "B.h"
  3. @interface B ()
  4. {
  5. Bcpp myBcpp; // declare instance c++ variable of type Bcpp
  6. }
  7. @end
  8.  
  9. #import "Acpp.h"
  10. #import "A.h"
  11. @interface A ()
  12. {
  13. Acpp myAcpp; // declare instance c++ variable of type Acpp
  14. }
  15. @end
  16.  
  17. @implementation A
  18. // method to return an instance of B from an instance of A (self)
  19. - (B)GetBfromA
  20. {
  21. Bcpp *bfroma = myAcpp.GetBfromA(); // return c++ object
  22. // How do i find the objective C++ object B from its wrapped c++ instance bfroma?
  23.  
  24. }
  25. @end
  26.  
  27. - (id)initWithBcpp:(Bcpp*)bcpp
  28. {
  29. self = [super init];
  30. if (self != nil)
  31. {
  32. myBcpp = *bcpp;
  33. }
  34. return self;
  35. }
  36.  
  37. - (B*)GetBfromA
  38. {
  39. Bcpp *bfroma = myAcpp.GetBfromA(); // return c++ object
  40. B* result = [[B alloc] initWithBcpp:bfroma];
  41. return result;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement