Thank you! The intention of addChild's frog argument was that if the frog were to have children then it should have be instantiated with createFrog right before being passed in the instance. So there's the parent frog who had a baby (and the baby frog should have been instantiated with createFrog which is now also an instance of a frog sometime in our app before being passed as a child)
Great article, just one thing. Isn't the first snippet supposed to be
addChild(name)
?Thank you! The intention of addChild's
frog
argument was that if the frog were to have children then it should have be instantiated withcreateFrog
right before being passed in the instance. So there's the parent frog who had a baby (and the baby frog should have been instantiated withcreateFrog
which is now also an instance of a frog sometime in our app before being passed as a child)So in the code it would look something like this:
or