Learned behavior - (if I'm thinking of the question right)
Explanation:
Because your dog doesn't want to get smacked, it learns to welcome strangers. This is a learned behavior