Changes

Jump to navigation Jump to search
12 bytes added ,  09:55, 3 April 2015
Line 278: Line 278:  
== Polymorphism ==
 
== Polymorphism ==
 
You can point a variable of a parent type to a child type, it will have the methods from it's type but overriden by the subclass.<br />
 
You can point a variable of a parent type to a child type, it will have the methods from it's type but overriden by the subclass.<br />
You wont be able to call methods from the subclass that are not implemented on the variable type.
+
You wont be able to call methods from the subclass that are not implemented on the variable type.<br />
Example files:
+
Example files:<br />
 
[https://github.com/rafahsolis/javaTutorial/blob/master/Polymorphism.java Polymorphism.java]<br />
 
[https://github.com/rafahsolis/javaTutorial/blob/master/Polymorphism.java Polymorphism.java]<br />
 
[https://github.com/rafahsolis/javaTutorial/blob/master/Plant.java Plant.java]<br />
 
[https://github.com/rafahsolis/javaTutorial/blob/master/Plant.java Plant.java]<br />

Navigation menu