Whats the use of virtual keyword in c#?
-
e.g: public virtual void ClearLastException() { LastException = null; }
-
Answer:
When you create a child class of the class which contains the virtual method you will be able to override the method which has the virtual keyword. in your example you have a method 'clearLastException'. If i was to create a class which is a child class of the parent class which contains 'clearLastException' i would be able to override this method. msdn explanation: http://msdn2.microsoft.com/en-us/library/9fkccyh4.aspx wikipaedia explanation of inheritance: http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29
Atty at Yahoo! Answers Visit the source
Related Q & A:
- Why cannot we use static keyword inside a method in java?Best solution by Stack Overflow
- How Can I use .net dll in C program?Best solution by Stack Overflow
- How to use PlaySound in C?Best solution by Stack Overflow
- Can I use ajax to call c#?Best solution by Stack Overflow
- How to use GUI in c language?Which is best GUI for c?Best solution by Quora
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.