sealed methods, why to include the override modifier

  • Thread starter Thread starter muler
  • Start date Start date
M

muler

"If an instance method declaration includes the sealed modifier, it
must also include the override modifier." The C# Programming Language,
§ 10.5.5 Sealed Methods

Why is this?

Thanks,
Mulugeta
 
"If an instance method declaration includes the sealed modifier, it
must also include the override modifier." The C# Programming Language,
§ 10.5.5 Sealed Methods

Why is this?

The "sealed" modifier is only used when overriding a virtual method -
if you're not overriding anything, the method is implicitly sealed
unless you use the "virtual" modifier.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top