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
What is the function of this pointer?
What is the use of in c?
#include
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Can you write the function prototype, definition and mention the other requirements.
What are multidimensional arrays?
how many key words availabel in c a) 28 b) 31 c) 32
What are keywords c?
What’s a signal? Explain what do I use signals for?
Can you subtract pointers from each other? Why would you?
How can I recover the file name given an open stream?
What is the difference between printf and scanf in c?
Hi can anyone tell what is a start up code?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
When is a void pointer used?