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 are the generation of Garbage Collection in C# .NET ?
Is array ienumerable c#?
What’s thread.sleep() in threading ?
What does the dispose method do with the connection object?
What is disco?
What is difference between static and constant variable?
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
Is c# pass by reference?
What is property in c#?
How to block a class from being inherited further?
What is difference between array and collection?
why delegate is type safe?
What is the difference between array and list in c#?
What is a variable in c#?
how to print invert pyramid in c#