_var Classes
  • Refer to Object_var Examples
  • The _var classes are wrappers around pointers to a type
    • state is private, usually a pointer and a release flag
    • In many contexts they act like the raw pointer (#1)
    • Assigning a pointer to a var (#2):
      • Releases the pointer the var had
      • Gives ownership of one reference to the var
    • Assigning a var to a var (#3)
      • Release the pointer of the LHS var
      • Gives the LHS var a duplicate of the RHS var
    • The destructor for var types (#4)
      • releases a reference if the pointer is not NULL
    • The _retn() method is used to return values (#5)
      • The pointer is returned and forgotten
    • The out() method (#6)
      • releases the reference, returns a holder for an out parameter

Next Slide >>