Juxtapose the use of override with new. What is shadowing?



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

Post New Answer

More C Interview Questions

Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return - 1. The function should not make use of any C library function calls.

3 Answers   Google, Infosys, JTL, OpenFeel,


difference between c and c++

3 Answers  


What is sizeof return in c?

0 Answers  


What is a macro in c preprocessor?

0 Answers  


What does c mean?

0 Answers  






a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

0 Answers  


Is a house a mass structure?

0 Answers  


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

0 Answers   TCS,


what is the significance of static storage class specifier?

0 Answers  


what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

0 Answers  


write a program fibonacci series and palindrome program in c

0 Answers   Aditi Placement Service,


When is a null pointer used?

0 Answers  


Categories