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

What is a c# delegate?

601


Explain the difference between Response.Write () and Response.Output.Write ().

524


What is default class in c#?

497


Tell us something about static linking and dynamic linking?

529


What does protected internal access modifier mean?

541






Can a class have more than 1 destructor?

509


Which is more efficient for loop or while loop?

463


Which config file has all the supported channels/protocol?

541


What is a cs file?

505


What are the properties of string?

484


Why generics are used?

489


How does dll hell solve in .net?

478


What is object array in c#?

499


Explain jagged arrays in c#?

560


What is ioc containers c#?

442