Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualPink Horror

Posted 05 October 2013 - 05:01 PM

A protected static function in Component would be able to access whatever you need in Component and be called from any Component.

static void SetParentOfChild(Component* child, Component* parent)
{
    child->parent = parent;
}

Note: I don't think you should be passing unique_ptr around by value. Would would addChild use a smart pointer and removeChild a const reference? You have to modify the child's parent member in both situations, right?


#1Pink Horror

Posted 05 October 2013 - 04:56 PM

A protected static function in Component would be able to access whatever you need in Component and be called from any Component.

static void SetParentOfChild(Component* child, Component* parent)
{
    child->parent = parent;
}

PARTNERS