Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Java
(view source)
Revision as of 09:54, 3 April 2015
530 bytes added
,
09:54, 3 April 2015
no edit summary
Line 275:
Line 275:
protected → can only be by the class where it was declarated, subclasses and from it's package.<br />
protected → can only be by the class where it was declarated, subclasses and from it's package.<br />
no access specifier → only accesible from the same package.<br />
no access specifier → only accesible from the same package.<br />
+
+
== 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 wont be able to call methods from the subclass that are not implemented on the variable type.
+
Example files:
+
[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/Tree.java Tree.java]
== Eclipse shortcuts ==
== Eclipse shortcuts ==
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version