"correct" is certainly not the right way to put that. Inheritance and composition here are both fully valid methods for modeling the relationship, and the decision to use either should be dependent on how the models are being used and the expectation for future extension.
By "correct" here you only mean fashionable. Either approach works. Each has its merits and its costs.
Any big enough system will have parts that are most sensibly built object-oriented, and other parts that are more reasonably functional, plus anything else you can think of.
if you have a person class and you have students and teachers
the correct thing to to is NOT to make student and teacher inherit from person
it's to make student and teacher have a person attribute + the other attributes that constitute a student and teacher respectively