Skip to content

Commit f1f69fa

Browse files
author
Ram swaroop
committed
added ads
1 parent 082f330 commit f1f69fa

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

_posts/2015-05-21-declarations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,4 @@ __Some points to note:__
238238
* Every enum has a static method, values(), that returns an array of the enum's
239239
values in the order they're declared.
240240

241-
242241
{% include responsive_ad.html %}

_posts/2015-05-25-object-oriented-design.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ declared type__.
8181
type, it can reference any object of any class that implements the interface.
8282

8383
More on polymorphism in [Overriding](/2015/05/29/overriding.html) & Overloading in Java.
84+
85+
{% include responsive_ad.html %}

_posts/2015-05-29-overriding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ overriding implies that you're reimplementing a method you inherited.
109109
__Dynamic Method Invocation:__ Overridden instance methods are dynamically invoked based on the real object's type
110110
rather than the reference type. For example, `b.eat()` will actually run the Horse version of `eat()`.
111111

112-
-------
112+
{% include responsive_ad.html %}
113113

114114
### Q&A
115115

_posts/2015-06-02-overloading.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,18 @@ The output of the above program is:
8080
In the Horse version
8181
In the Animal version
8282

83-
Notice the call to `doStuff(animalRefToHorse)`, here the `Animal` version of `doStuff()` is called despite the actual
84-
object being passed is of a `Horse`. The reference type (not the object type) determines which overloaded method is
83+
Notice the call `doStuff(animalRefToHorse)`, here the `Animal` version of `doStuff()` is called despite the actual
84+
object being passed is of a `Horse`. The __reference type__ (not the object type) determines which overloaded method is
8585
invoked.
8686

8787
To summarize, __which overridden version__ of the method to call (in other words, from which class in the
8888
inheritance tree) is decided __at runtime based on object type__, but __which overloaded version__ of the method to
8989
call is based on the __reference type of the argument passed at compile time__.
9090

91-
---------
91+
Therefore, polymorphism doesn't determine which overloaded version is called, polymorphism does come into play when
92+
the decision is about which overridden version of a method is called.
93+
94+
{% include responsive_ad.html %}
9295

9396
### Q&A
9497

0 commit comments

Comments
 (0)