giriraj katheeria
what is the difference between override and new keyword?
By giriraj katheeria in C# on Aug 21 2006
  • Abhishek Agrawal
    Aug, 2006 22

    If we talk about inheritence than new keyword has a totally different meaning. suppose there is fuction in base class (virtual / non virtual) and we declare a new function in derived class with the same name but do not override it. then the compiler wd generate a warning stating tht this function is already defined in the base class. if we use new keyword thn the WE TELL THE COMPILER THT I AM AN EXPERIENCED PROGRAMMER AND I KNOW WHAT I AM DOING so plz dont generate a warning. virtual is the firat implementation of a function. override is another implementation of parent class function. new does not have ne effect except to stop the warning sealed is the last implementation of a funcyion

    • 0
  • Ajay Sahu
    Aug, 2006 22

    Override V/S New

    Override is basically used for Function

    When we provide different definition to Base class function in derived class go for Override

    And

    New keyword is used to allocate memory to variable

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS