Download presentation
Presentation is loading. Please wait.
Published bySarah McKinney Modified over 9 years ago
1
Polymorphism Introduction
2
Polymorphism Example in Biology: –Different ‘forms’, same species Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia Light-morph jaguar Dark-morph or black or melanistic jaguar
3
Polymorphism Example in Biology: –Different ‘forms’ between males and females of the same species Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia
4
Polymorphism In Java OOP: –Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class. Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia
5
Polymorphism public class CylinderDemo { public static void main(String[] args) { Shape shape; shape = new Shape(); System.out.println("Area of current shape: " + shape.getArea()); shape = null; shape = new Circle(10); System.out.println("Area of current shape: " + shape.getArea()); shape = null; shape = new Cylinder(11, 21); System.out.println(" Area of current shape: " + shape.getArea()); shape = null; } Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia
6
References Oracle. The Java Tutorials. [Online]. http://docs.oracle.com/javase/tutorial/http://docs.oracle.com/javase/tutorial/ Oracle. Java SE Tutorial 2012-02-28 [Online]. http://www.oracle.com/technetwork/java/javase/downloads/java-se-7- tutorial-2012-02-28-1536013.html http://www.oracle.com/technetwork/java/javase/downloads/java-se-7- tutorial-2012-02-28-1536013.html Oracle. Java SE Downloads [Online]. http://www.oracle.com/technetwork/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/index.html Harvey M. Deitel and Paul J. Deitel, Java: How to Program, 6th ed.: Prentice Hall, 2004. Ken Arnold, James Gosling, and David Holmes, The Java Programming Language, 4th ed.: Addison Wesley Professional, 2005. Sharon Zakhour, Scott Hommel, Jacob Royal, Isaac Rabinovitch, and Tom Risser, The Java Tutorial Fourth Edition: A Short Course on the Basics, 4th ed.: Addison Wesley Professional, 2006. Y. Daniel Liang, Introduction to Java Programming, 6 th ed.: Pearson Prentice Hall, 2007. Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia
7
References Wikipedia. Sexual dimorphism. [Online]. http://en.wikipedia.org/wiki/Sexual_dimorphism http://en.wikipedia.org/wiki/Sexual_dimorphism Wikipedia. Polymorphism (biology). [Online]. http://en.wikipedia.org/wiki/Polymorphism_(biology) http://en.wikipedia.org/wiki/Polymorphism_(biology) Adapted and adopted from Deitel (2004), IBM (2004), Liang (2007), Oracle (2012), and Wikipedia
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.