When creating different classes and programming strings, learning how to apply the right string at the right time is crucial. Polymorphism helps with exactly that issue. What is polymorphism? It is the term for programming that automatically detects the right response to different actions. Learn how polymorphism can streamline your code by watching this online video.
- View Offline
Finally, we have Polymorphism, which means many forms.…It's the most complex of the four terms, but very powerful.…It lets us automatically do the correct behavior even if what we're working with…could take one of many different forms. Well, that sounds a little vague.…So, here's an example of polymorphism that you've probably used without…even thinking about it: the Plus sign. Well, what does this do?…In a lot of languages, it depends.…If we're adding two variables together with the plus sign, if these variables…are integers, it will numerically add them.…
But on the other hand, if the variables A and B are strings, what will happen is…that we'll concatenate them.…It will automatically do the correct behavior but a different behavior when what…we've given it could have one of many different forms.…Now, this example is built into a lot of languages, but we can use the same idea…with our own classes and our own objects.…So, here's an example.…If I define a BankAccount class for a financial application and it describes…
Let Simon Allardice introduce you to the terms—words like abstraction, inheritance, polymorphism, subclass—and guide you through defining your requirements and identifying use cases for your program. The course also covers creating conceptual models of your program with design patterns, class and sequence diagrams, and unified modeling language (UML) tools, and then shows how to convert the diagrams into code.
- Why use object-oriented design (OOD)?
- Pinpointing use cases, actors, and scenarios
- Identifying class responsibilities and relationships
- Creating class diagrams
- Using abstract classes
- Working with inheritance
- Creating advanced UML diagrams
- Understanding object-oriented design principles