Well the beliefs that a person has are often shaped by their upbringing. Usually, a child will imitate their parents, and often ends up believing in the same things the parents did. Sometimes, though, the child feels a need to be different from the parents and ends up having different views. For example, if the child sees their parent do something that is clearly wrong, their views may change. Experience is a teacher.