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
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
What is the right way to use errno?
What is the use of pointers in C?
What is omp_num_threads?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What is meant by preprocessor in c?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
When should the volatile modifier be used?
Are comments included during the compilation stage and placed in the EXE file as well?
When should you use a type cast?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
What does typedef struct mean?
What is the difference between fread buffer() and fwrite buffer()?
What is the acronym for ansi?
What are derived data types in c?