Converting (casting) between parent and child variables