Juxtapose the use of override with new. What is shadowing?
Answer Posted / nawaz
Using override keyword to a method in the derived class
meaning the method provides a new implementation to the
overridden method (same signature) in the base class. The
base method must be virtual, abstract, or override.
By default a method is not modified by ‘virtual’. So if a
method in derived class wants to override the base
implementation, it needs to be modified by ‘new’ keyword.
This is called shadowing, not overriding. The method in the
derived HIDES the one in the base class.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Which programming language is best for getting job 2020?
What is the difference between procedural and functional programming?
What is the general form of function in c?
What is a null string in c?
What language is lisp written in?
What are the preprocessor categories?
I have seen function declarations that look like this
What is #include stdio h and #include conio h?
How to explain the final year project as a fresher please answer with sample project
what is bit rate & baud rate? plz give wave forms
hi, which software companys will take,if d candidate's % is jst 55%?
number of times a digit is present in a number
What is the difference between constant pointer and constant variable?
What does %p mean c?
Explain about the functions strcat() and strcmp()?