What is polymorphism?
In software programming, object -oriented programming (PP) is trying to create objects from real things. The theory and practice of polymorphism is strongly supported within the PLO principles. In general, the object should be created in such a way that it has basic features and behavior with the understanding that it will change when it becomes a specific type.
Polymorphism is the ability to have a variable, function or object with more than one meaning within the program. There are several designs of architectures that show polymorphism. These suggestions outline how the object will be re -used in the application for more purposes.
Many programming languages support the use of polymorphism. This process allows the re -use of business rules and software code within the application. Not all programming languages support full polymorphic behavior, but most support the basic concept. All right languages OOP including Java®, .NET and C ++ ® Support more advanced approaches and techniques.
Bank account is a good forFor example, a basic object that could promote polymorphism. All bank accounts have account numbers, names and balance. What makes an account unique is the type of account. Some types of types are savings accounts, checking accounts or money market accounts. In polymorphism, a bank account would be a basic object with more specific accounts using the functions of a basic bank account. Each account could then have additional behavior in support of interest rates or sanctions for the selection of information about the bank account.
Using polymorphism theories, developers save time by reducing unnecessary code. It makes it easier to write code and it is easier for others to understand. In addition, the software is expandable, as future types can be added later using an object with a predecessor of the existing code. In general, applications developed in this way are more flexible and easier to expand by required to requireLess code for future modifications
Theory of polymorphism also applies to functions. The function is a piece of software code that performs a specific task. The function can also be written in a polymorph. This approach makes the code more flexible because the function can be reused for other business rules within the software.
A good example of polymorphism with a function would be a sorting function. This type of function would sort a list of numbers. The polymorphic function could not only sort the numbers, but could also sort any type of objects. This makes the function more efficient because it works on multiple data types.