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
What is thread safe in c#?
What is the difference between private and protected in c#?
Value Type and Reference Type Data type in C#?
Explain get and set accessor properties?
what is main function of alternate teamplate of datalist?
What is an array of arrays called?
How many types of variables are there in c#?
Describe ways of cleaning up objects in c#.
What are the different types of constructors in c#?
What is clr namespace?
What is the difference between double and decimal in c#?
How can you reference current thread of the method ?
Howmany five tracing levels in System.Diagnostics.TraceSwitcher? Why they are using?
What is a streamwriter in c#?
What is semaphore in c#?