Skip to main content

Posts

Showing posts with the label polymorphism

When Lazy is Good: Overloading and APIs

When more than one subprogram (procedure or function) in the same scope share the same name, the subprograms are said to be overloaded. PL/SQL supports the overloading of procedures and functions in the declaration section of a block (named or anonymous), package specifications and bodies, and object type definitions. Overloading is a very powerful feature, and you should exploit it fully to improve the usability of your software. Before exploring some of the details of overloading, a short quiz: Which of the following is another name for overloading? Dynamic Polymorphism Interface Inheritance Static Polymorphism Multiple Monomorphism In a poll I conducted on Twitter , we saw the following results: And I was very glad to see this, because Static Polymorphism is, indeed, another name for overloading, and here's why: With overloading, at the time your code is compiled, PL/SQL resolves all references to named elements, such as a function invocation. If there is more ...