- Describing something else in a simpler or more flexible way.
- Indirection: Indirectly dealing with something, in the hopes of simplifying how we work with it, or working with it more flexibly, or without it having to be present.
- en-capsule: "putting something in a capsule/container and the benefits we get from it"
- Grouping things together
- You know where to find those things
- You can make it more secure
- Encapsulation is bundling data together, perhaps along with tools for working with that data, protecting the data from being accessed or changed unexpectedly.
- "poly-": multiple or many
- "-morph-": change or variation or shape
- Same command/message, possibly different results
- Telling kids "It is time to go home": they may go to different places, by different means, but they all know to respond/react to the same message.
- Telling animals to "speak"
- Inheritance is a particular example of polymorphism in class systems, where you create a "Parent Class" (or, "Superclass") and one or more "Child Classes" (or, "Subclasses"). A child class should inherit the features of its parent class. And if the parent class itself has a parent class, then our child class should inherit the features of both parent classes.
- Examples:
- User Class
- TrialUser Class
- ContractorUser Class
- ModeratorUser Class
- AdminUser Class
- SuperAdminUser Class
- new SuperAdminUser()
- SuperAdminUser Class
- AdminUser Class
- User Class