OK. My original “back to basic” post turned out to be very popular. Not a few people have visited this blog due to the “Pointer to Array vs. Array of Pointer, and the most dynamic array” post.
So, :) I would like to write one more thing about “basic”.
How many Korean visitors to my blog can differentiate “overloading” and “overriding” of C++ method? If you just use the mechanism but have not thought about the words for long time, then do you still remember the difference? Yes. You DO know the difference. However, don’t you use the word “overloading” for “overriding” and “overriding” for “overloading”? In other words, although you know the difference, you don’t remember the words for referring them.
Yeah.. to non-English native speakers, those words can be confusing.
Then how to remember the actual meaning of the two words?
Here is a typical example of “overload”.
What “overload” menas is to load too much.
And here is an example of “overriding”
So, as you can see overriding is vertical. It is to riding someone else’s shoulder or back.
So, it is to write the same method which is defined in its parent class.
Therefore, a method with same name in a child class “override” the same function in its parent class.
On the other hands, “overloading” is horizontal. It is to put too many things on a truck.
So, it is to declare/define multiple methods with same name in a class.
Although parameters are different, they have same names and there are many methods with the same name in a class. So it is “overloading”.
Easy… isn’t it?