About Virtual functions and their use ?

Answer Posted / om shivaya namaha

Suppose we have 4 class

Class
Base (haveing method Display())
Class | Class
Parent1-------------------------------------------Parent2
(having method : Par1) (having method : Par2)
| |
-------------------------------------------------
|
Class Child( having Method :ch1)



as Parent1,Parent2 derived from the Base class the Method
Display will be inherited in both Parent Classes and the
Child class is inherited from parent1,parent2
so the Child class may contain Display(Base class Method)
method 2 time so it will create runtime problems to avoid
such problems we have to use Virtual Overide concepts


Class
Base (haveing method Virtual:Display())
Class | Class
Parent1-------------------------------------------Parent2
(having method : Par1) (having method : Par2)
Override : Display() Override : Display()
| |
-------------------------------------------------
|
Class Child( having Method :ch1)

then the Child class will contail only one Display method

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can an abstract class have a constructor c#?

581


Does c# support parameterized properties?

598


Which property of the textbox cannot be changed at runtime?

554


Are arraylist faster or arrays?

589


What is meant by collections in c#?

531






What are types in c#?

594


Why do we use 0?

594


What is verbatim string?

590


Define acid rule of thumb for transactions in c#.

572


What is the difference between string and string in c#?

569


Explain circular reference in c#?

631


Why we need get set property in c#?

630


Is c# and c sharp same?

550


Can bool be null c#?

583


What is alias in c#?

637