Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Feb 9th, 2013  |  syntax: None  |  size: 0.77 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }