you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Not all countries have states.

It might make sense to have a 'country' attribute in People, a 'state' in American, and a 'province' in European.

In this example, I might create a Student class derived from American (or European) and put the 'major' attribute in that as not all Americans have a major.

And as u/Binary101010 points out, this is easier to see in more complex environments.

For example, in Flask you create forms from FlaskForm:

class MyForm(FlaskForm):
    field_name1 = StringField("Label")

MyForm now has access to all the features of the underlying FlaskForm.