Juxtapose the use of override with new. What is shadowing?
Answer / 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 |
What is the use of getchar() function?
The file stdio.h, what does it contain?
What does *p++ do? What does it point to?
What is structure packing in c?
What is structure of c program?
How can I read and write comma-delimited text?
In a switch statement, what will happen if a break statement is omitted?
what is the output of the following program? #include<stdio.h> void main() { int x=4,y=3,z; z=x-- -y; printf("\n%d %d %d",x,y,z); }
What are the salient features of c languages?
Does c have function or method?
What is the maximum no. of arguments that can be given in a command line in C.?
What is c basic?