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

State two uses of pointers in C?

0 Answers   Aspire, Infogain,


What is the use of typedef in c?

0 Answers  


can you change name of main()?how?

3 Answers   HCL, Siemens,


Develop a flow chart and write a c program to find the roots of a quadratic equation ax2+bx+c=0 using switch and break statement.

1 Answers   TCS,


why u join this call center?

6 Answers   DELL,






What is %s and %d in c?

0 Answers  


what is the difference between malloc() and calloc() function?

1 Answers  


Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

0 Answers  


what is use of malloc and calloc?

0 Answers  


What is sorting in c plus plus?

0 Answers  


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

1 Answers   TCS,


What is array in C

0 Answers  


Categories