What does the term "Inheritance" mean?

Inheritance is an object-oriented programming term. It refers to how you can write two different classes but one inherits its functionality from another and builds upon it.

I like to explain this by using dogs as an example.

All dogs have fur, legs, tails, eyes etc. but you also have different breeds of dog, with all of the previously listed things but slight changes such as some having long fur, and others short, for example.

So, if you have a class called dog, the class called jack_russell_terrier would inherit the properties of dog, but would have the extra features that make a jack russel terrier different to other dogs.

Leave a Reply

Thank you for choosing to leave a comment. Comments may be moderated.