The law should have nothing to do with the will and inheritance of someone. It should be the decision of the father or the parents to decide whether they would want their child to have whatever they have after they are no more or not if they think he is living a dishonorable and disgraceful life, they decide to take and no court or law should force them to not do it if their child is dishonorable or whatever, it's their child, so just let them decide what to do with the inheritance.
That should be the case but the law wanted to protect innocent people of their right. As long as the heir does not bring shame to the family, or trouble that degrade their family's reputation, the heir can contest if the parents decided to remove his inheritance. That is at least what is the law in my country. If the action of disinheriting is not legally done, then as I stated the supposed to be heir that is inherited can file an appeal to the court.
I think that is better that way to avoid exploit and abuse of disinheriting.
The same should go for the child, there should be no case against the parents in case they disinherit them and don't want to give their wealth to them. A person has all the right to choose who they want to inherit their belongings after they die, even a person who works as a maid in their house or maybe a friend, a relative, or anything.
But some country protects the right of person to inheritance. This is made to avoid confusion and misunderstanding between relatives, and the government had made an order of priority. And this order is protected by the law, thus if something not normal happened, like disinheritance of the supposed to be heir, it should be done legally and can be contested legally. Legally means according to what is written on the country's law about inheritance.