or am I missing something basic here??..
since sealed method avoids it to be overridden in the derived class and virtual allows it to
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
virtualkeyword will let you (or someone using your code) override a given method with their own logic.The
abstractkeyword will force you (or someone else using your code) to override it with your own logic.The
sealedkeyword will let you (or someone using your code) prevent any further modification of a method.An overriden method can be overriden again if you don’t add “sealed”.
When you think of these keywords, think of both scenarios: you can code for yourself, or you can create DLLs and code libraries for others to use. The latter scenario will often warrant the use of sealed, abstract and virtual.
Hope this helps!