KEMBAR78
Integrative Coding (Polymorphism) | PDF | Method (Computer Programming) | Inheritance (Object Oriented Programming)
0% found this document useful (0 votes)
13 views12 pages

Integrative Coding (Polymorphism)

Polymorphism allows a supertype variable to refer to a subtype object and can be defined in various contexts, such as Chemistry and Java. It has characteristics that include method behavior depending on data and is primarily used to implement inheritance. There are two types of polymorphism: Compile-Time (static) and Run-Time (dynamic), each with distinct execution characteristics and flexibility.

Uploaded by

Jomarie Isorena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views12 pages

Integrative Coding (Polymorphism)

Polymorphism allows a supertype variable to refer to a subtype object and can be defined in various contexts, such as Chemistry and Java. It has characteristics that include method behavior depending on data and is primarily used to implement inheritance. There are two types of polymorphism: Compile-Time (static) and Run-Time (dynamic), each with distinct execution characteristics and flexibility.

Uploaded by

Jomarie Isorena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Department of Computational Science

BSIT | BSCS | BSMath

IPT1

Integrative Coding
Polymorphism

Jomarie S. Isorena
Polymorphism

● Polymorphism means that a variable of a supertype can refer to a


subtype object.
○ A type defined by a subclass is called a subtype, and a type
defined by its superclass is called a supertype.
Polymorphism

● According to Chemistry:
○ The term polymorphism can be defined as the ability of any
element or compound to exit in multiple crystalline forms is
called Polymorphism.

● According to Java:
○ Polymorphism is defined as the ability of any object in a class to
perform a particular task in multiple methods is known as
Polymorphism in Java
Polymorphism
Polymorphism
Polymorphism
Polymorphism - Characteristics

● The functionality of a method behaves different situation


● The behavior of a method is depended on the data
● Polymorphism is mainly used to implement inheritance
● It allows same name for a member or method in a class with different
types
Polymorphism - TYPES

● Compile-Time Polymorphism
● Run-Time Polymorphism
Polymorphism - TYPES

● Compile-Time Polymorphism
○ Gets executed during
compilation stage. Here, the
overloading method gets
resolved in compilation
stage
○ Also known as static
polymorphism
Polymorphism - TYPES
● Run-Time Polymorphism
○ Gets handled during the
program execution stage. Here,
the overriding method gets
resolved in execution stage.
○ Also known as Dynamic Binding
or Dynamic Method Dispatch
Polymorphism

Compile-time Polymorphism Run-time Polymorphism

Method call is handled by the compiler itself Method call cannot handled by the compiler
in execution time

Compile-time polymorphism is less flexible as Run-time polymorphism exhibit flexible as


it needs handle all method calls in the method calls gets handled at run-time
compile-time

Integrating the right method call with the right Integrating the right method call with the right
method is doe in compile-time method is doe in run-time

Occurs during Method Overloading Occurs during Method Overriding


Department of Computational Science
BSIT | BSCS | BSMath

Thank you!

You might also like