Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

replacement and refinement  RSS feed

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
what is the meaning of replacement and refinement.

replacement and refinement are also called as overloading and overriding is it correct,please clear this.
 
Prakash Rao Laknepalli
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actual Question:

hai,
what is the meaning of replacement and refinement.

replacement and refinement are also called as overloading and overriding is it correct,please clear this.

Hi Ramchander,

You are completely mistaken. Replacement & Refinement are not equal to Overloading and Overriding respectively.
Infact both are types of Overriding only i.e comes in inheritance.
Replacement meand a derived class defines a new method whose signature is exacltly similar to the base class method i.e it replaces the base class body with a new one hence the name.
where as, refinement preserves the body of the base method, and enhances(adds some more code)the base method i.e it refines the base class method hence the name.
In summary, in Replacement base method code is hidden by the derived code, where as in Refinement base method body is enhanced by preserving it.
In general, in both languages C++ & java default it is Replacement.

hope this helps.

-prakash
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!