
POLYMORPHISM helps us to learn Right Message At Right Time !!!
Object Oriented Programming Language is one of the most important word in today’s programming world. OOPS exists in so many programming languages like Java, Python, JavaScript, C++, Php. So without understanding the idea behind this ,one cannot improve any of these languages. And our OOPS is mostly inter-related with our day to day life. Lets see how this is related.
Object -> It is an instance of a class, Object is an copy of that class and Instance is a variable that holds the memory address of the object.
Polymorphism
“Polymorphism is one of the oops concept “
Ability to have different forms ie: Function with same name and different parameters.
There are Two ways to achieve Polymorphism ,
- Method Overloading – Static polymorphism
- Method Overriding – Dynamic polymorphism
We will see overloading first !
1 . Consider a Human being , (he/she) behaves like a customer in a super market, behaves like a passenger while travelling, behaves like a child when they are with their parents and so on.
- One person(he/she) may have 2 or more phone numbers.
Static polymorphism is achieved by method overloading.ie during compile time.
Eg : Here is a class named SimpleCalulator and it consists of two methods add(int a ,int b) which has two integer parameters and another method named int add(int a,int b,int c) which has three integer parameters. Then object is created for class and (functions/methods ) are called with values , and this is static polymorphism. During our compile time values are passed to the resp function.
OUTPUT:
- Difference with type given
- Difference with size given
->This we call as Method overloading.
Method Overriding!
- Here is an real time example for overriding, consider a Bank and now a days there are number of banks , one common thing about all the banks is INTEREST. Every bank possess different amount of interest for various properties but Interest is one common thing.
Here getRateOfInterest() method is common for all banks as I said before , we get different outputs with different classes with same function name. This is Overriding.
- Different classes with same method name and same parameter.
Hope this blog inspires you to embrace change and grow. Whether you are an XPLORER or not, feel free to glance through our blogs and help us guide and support you in your voyage to success. Happy Learning!
- # VLSI
- #A+N+
- #ADO.NET
- #Advanced JAVA
- #ANDROID
- #ARM
- #ASP.NET
- #Big DATA
- #Bootstrap
- #C
- #C Programming
- #CBE
- #CCNA
- #CEH
- #Cloud Computing
- #CodeIgnitor
- #CORPORATE Training
- #CSS
- #DATA MINING
- #Django
- #DNA
- #Embedded systems
- #Ethical Hacking
- #Frameworks
- #Hadoop
- #hibernate
- #HTML5
- #INDIA
- #INSTITUTIONAL Training
- #ITIL
- #J2EE
- #JAVA
- #Java Script
- #LAB View
- #LINUX
- #Magneto
- #MAT LAB
- #MCSA
- #MCSE
- #Mongo DB
- #MVC
- #MySQL
- #Networking
- #OCJP
- #openCV
- #ORACLE
- #PCB Designing
- #Perl
- #PHP
- #PIC
- #Placement Training
- #PLC
- #PLSQL
- #PMP
- #Python
- #R Programming
- #Raspberry Pi
- #RDBMS
- #RETAIL Training
- #RHCE
- #RIA
- #SAP
- #SAS
- #selenium
- #Soft Skills
- #software testing
- #Spring
- #Struts
- #VB.NET
- #Web Designing
- #Windows Server
- #Word press
- #XIC
- #XPLORE IT CORP
0 responses on "POLYMORPHISM helps us to learn Right Message At Right Time !!!"