A change in the law will make it a criminal offence for parents to use any physical punishment on their children.